about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/fan_out_on_write_service.rb2
-rw-r--r--app/services/post_status_service.rb3
-rw-r--r--app/services/process_mentions_service.rb2
-rw-r--r--app/services/update_status_service.rb2
4 files changed, 7 insertions, 2 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 6102ed1e5..1e12def33 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -92,7 +92,7 @@ class FanOutOnWriteService < BaseService
 
     Rails.logger.debug "Delivering status #{status.id} to public timeline"
 
-    Redis.current.set(key, true, ex: 6.hours)
+    Redis.current.set(key, 1, ex: 6.hours)
 
     Redis.current.publish('timeline:public', @payload)
     if status.local?
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index 82588d254..c6a983001 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -27,6 +27,7 @@ class PostStatusService < BaseService
   # @option [Enumerable] :mentions Optional array of Mentions to include
   # @option [Enumerable] :tags Option array of tag names to include
   # @option [Boolean] :publish If true, status will be published
+  # @option [Boolean] :notify If false, status will not be delivered to local timelines or mentions
   # @return [Status]
   def call(account, options = {})
     @account     = account
@@ -91,6 +92,8 @@ class PostStatusService < BaseService
       @status = @account.statuses.create!(status_attributes)
     end
 
+    @status.notify = @options[:notify] if @options[:notify].present?
+
     process_command_tags_service.call(@account, @status)
     process_hashtags_service.call(@status, nil, @tag_names)
     process_mentions_service.call(@status, mentions: @mentions, deliver: @options[:publish])
diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb
index 3752cebb9..fea00ef4f 100644
--- a/app/services/process_mentions_service.rb
+++ b/app/services/process_mentions_service.rb
@@ -31,7 +31,7 @@ class ProcessMentionsService < BaseService
     mentioned_account = mention.account
 
     if mentioned_account.local?
-      LocalNotificationWorker.perform_async(mentioned_account.id, mention.id, mention.class.name) unless mention.silent?
+      LocalNotificationWorker.perform_async(mentioned_account.id, mention.id, mention.class.name) unless !@status.notify? || mention.silent?
     elsif mentioned_account.activitypub? && !@status.local_only?
       ActivityPub::DeliveryWorker.perform_async(activitypub_json(mentioned_account.domain), mention.status.account_id, mentioned_account.inbox_url)
     end
diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb
index 05586aa1b..327cc74ea 100644
--- a/app/services/update_status_service.rb
+++ b/app/services/update_status_service.rb
@@ -147,6 +147,8 @@ class UpdateStatusService < BaseService
 
     ActivityPub::DistributionWorker.perform_async(@status.id) if @status.local? && !@status.local_only?
 
+    return unless @status.notify?
+
     mentions = @status.active_mentions.includes(:account).where(id: @new_mention_ids, accounts: { domain: nil })
     mentions.each { |mention| LocalNotificationWorker.perform_async(mention.account.id, mention.id, mention.class.name) }
   end