about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-05-21 01:54:08 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:51 -0500
commit55e048412166afe4202682ce22ced4f88841010f (patch)
treef85df084febd14eee9b65a3010b667ac29653003 /app/services
parent811137ef69f0f53e4bb8a4a731c6fb7302d3beb3 (diff)
add `skip_notify` option to service objects we might use for post imports
Diffstat (limited to 'app/services')
-rw-r--r--app/services/favourite_service.rb4
-rw-r--r--app/services/process_mentions_service.rb3
-rw-r--r--app/services/reblog_service.rb2
3 files changed, 5 insertions, 4 deletions
diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb
index 32699d132..ee3248877 100644
--- a/app/services/favourite_service.rb
+++ b/app/services/favourite_service.rb
@@ -7,7 +7,7 @@ class FavouriteService < BaseService
   # @param [Account] account
   # @param [Status] status
   # @return [Favourite]
-  def call(account, status)
+  def call(account, status, skip_notify = false)
     authorize_with account, status, :favourite?
 
     favourite = Favourite.find_by(account: account, status: status)
@@ -17,7 +17,7 @@ class FavouriteService < BaseService
     favourite = Favourite.create!(account: account, status: status)
 
     curate_status(status)
-    create_notification(favourite)
+    create_notification(favourite) unless skip_notify
     bump_potential_friendship(account, status)
 
     favourite
diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb
index f0d3d5fcb..738bfa2d6 100644
--- a/app/services/process_mentions_service.rb
+++ b/app/services/process_mentions_service.rb
@@ -4,7 +4,7 @@ class ProcessMentionsService < BaseService
   # Scan status for mentions and fetch remote mentioned users, create
   # local mention pointers
   # @param [Status] status
-  def call(status)
+  def call(status, skip_notify = false)
     return unless status.local? && !status.draft?
 
     @status  = status
@@ -31,6 +31,7 @@ class ProcessMentionsService < BaseService
 
     status.save!
 
+    return if skip_notify
     mentions.each { |mention| create_notification(mention) }
   end
 
diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb
index 847bd6fbf..9ac38ac9d 100644
--- a/app/services/reblog_service.rb
+++ b/app/services/reblog_service.rb
@@ -28,7 +28,7 @@ class ReblogService < BaseService
     end
 
     curate_status(reblogged_status)
-    create_notification(reblog)
+    create_notification(reblog) unless options[:skip_notify]
     bump_potential_friendship(account, reblog)
 
     reblog