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:
David Yip 2018-06-13 03:32:30 -05:00
parent f1bfcb50f0
commit 083f78b8fb
No known key found for this signature in database
GPG Key ID: 7DA0036508FCC0CC
4 changed files with 28 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,6 @@
module Glitch
class ApplyKeywordMutesService < BaseService
def call(account)
end
end
end

View 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

View File

@ -0,0 +1,5 @@
require 'rails_helper'
describe Glitch::ApplyKeywordMutesService, type: :service do
end