summaryrefslogtreecommitdiffstats
path: root/app/services
diff options
context:
space:
mode:
authorOSAMU SATO <satosamu@gmail.com>2020-10-13 08:01:14 +0900
committerGitHub <noreply@github.com>2020-10-13 01:01:14 +0200
commit96761752eccfc0d239974a24e0cc2d74c6aee7ac (patch)
tree1590275b4f8a1f954d90e870ef2bfb8ac00d7109 /app/services
parentf54ca3d08e068af07a5b7a8b139e7658b3236db8 (diff)
Add duration parameter to muting. (#13831)
* Adding duration to muting. * Remove useless checks
Diffstat (limited to 'app/services')
-rw-r--r--app/services/mute_service.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/services/mute_service.rb b/app/services/mute_service.rb
index 676804cb991..9ae9afd6234 100644
--- a/app/services/mute_service.rb
+++ b/app/services/mute_service.rb
@@ -1,10 +1,10 @@
# frozen_string_literal: true
class MuteService < BaseService
- def call(account, target_account, notifications: nil)
+ def call(account, target_account, notifications: nil, duration: 0)
return if account.id == target_account.id
- mute = account.mute!(target_account, notifications: notifications)
+ mute = account.mute!(target_account, notifications: notifications, duration: duration)
if mute.hide_notifications?
BlockWorker.perform_async(account.id, target_account.id)
@@ -12,6 +12,8 @@ class MuteService < BaseService
MuteWorker.perform_async(account.id, target_account.id)
end
+ DeleteMuteWorker.perform_at(duration.seconds, mute.id) if duration != 0
+
mute
end
end