mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-23 08:34:13 -05:00
Stub out Glitch::ApplyKeywordMutesService. #199.
This service will apply/unapply keyword mutes to home and mentions timelines. Maybe other timelines if I find a way to make it work.
This commit is contained in:
parent
f1bfcb50f0
commit
083f78b8fb
@ -15,6 +15,7 @@ class Settings::KeywordMutesController < Settings::BaseController
|
||||
@keyword_mute = keyword_mutes_for_account.create(keyword_mute_params)
|
||||
|
||||
if @keyword_mute.persisted?
|
||||
Glitch::ApplyKeywordMutesWorker.perform_async(current_account.id)
|
||||
redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg')
|
||||
else
|
||||
render :new
|
||||
@ -23,6 +24,7 @@ class Settings::KeywordMutesController < Settings::BaseController
|
||||
|
||||
def update
|
||||
if @keyword_mute.update(keyword_mute_params)
|
||||
Glitch::ApplyKeywordMutesWorker.perform_async(current_account.id)
|
||||
redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg')
|
||||
else
|
||||
render :edit
|
||||
@ -32,12 +34,14 @@ class Settings::KeywordMutesController < Settings::BaseController
|
||||
def destroy
|
||||
@keyword_mute.destroy!
|
||||
|
||||
Glitch::ApplyKeywordMutesWorker.perform_async(current_account.id)
|
||||
redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg')
|
||||
end
|
||||
|
||||
def destroy_all
|
||||
keyword_mutes_for_account.delete_all
|
||||
|
||||
Glitch::ApplyKeywordMutesWorker.perform_async(current_account.id)
|
||||
redirect_to settings_keyword_mutes_path, notice: I18n.t('generic.changes_saved_msg')
|
||||
end
|
||||
|
||||
|
6
app/services/glitch/apply_keyword_mutes_service.rb
Normal file
6
app/services/glitch/apply_keyword_mutes_service.rb
Normal file
@ -0,0 +1,6 @@
|
||||
module Glitch
|
||||
class ApplyKeywordMutesService < BaseService
|
||||
def call(account)
|
||||
end
|
||||
end
|
||||
end
|
13
app/workers/glitch/apply_keyword_mutes_worker.rb
Normal file
13
app/workers/glitch/apply_keyword_mutes_worker.rb
Normal file
@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Glitch
|
||||
class ApplyKeywordMutesWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options unique: :until_executed
|
||||
|
||||
def perform(account_id)
|
||||
Glitch::ApplyKeywordMutesService.new.call(Account.find(account_id))
|
||||
end
|
||||
end
|
||||
end
|
5
spec/services/glitch/apply_keyword_mutes_service_spec.rb
Normal file
5
spec/services/glitch/apply_keyword_mutes_service_spec.rb
Normal file
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Glitch::ApplyKeywordMutesService, type: :service do
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user