add `skip_notify` option to service objects we might use for post imports

staging
multiple creatures 2019-05-21 01:54:08 -05:00
parent 811137ef69
commit 55e0484121
3 changed files with 5 additions and 4 deletions

View File

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

View File

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

View File

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