about summary refs log tree commit diff
path: root/app/services/mute_conversation_service.rb
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-21 01:44:16 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:44:01 -0500
commit263ead73616dba43a0337c2a3edaf96a6382d533 (patch)
treeca47a9366dbbdf95018c55bde32b59d6b05c8299 /app/services/mute_conversation_service.rb
parent21de9efc2d89ce8dbb9edb997f8a3b99f831d05a (diff)
[Feature] Add post and thread (un)hiding to backend
Diffstat (limited to 'app/services/mute_conversation_service.rb')
-rw-r--r--app/services/mute_conversation_service.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/services/mute_conversation_service.rb b/app/services/mute_conversation_service.rb
new file mode 100644
index 000000000..46adb98dc
--- /dev/null
+++ b/app/services/mute_conversation_service.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class MuteConversationService < BaseService
+  def call(account, conversation, hidden: false)
+    return if account.blank? || conversation.blank?
+
+    account.mute_conversation!(conversation, hidden: hidden)
+    MuteConversationWorker.perform_async(account.id, conversation.id) if hidden
+  end
+end