Add notifications for inbound quotes (#35618)
This commit is contained in:
@@ -40,6 +40,7 @@ class FanOutOnWriteService < BaseService
|
||||
deliver_to_self!
|
||||
|
||||
unless @options[:skip_notifications]
|
||||
notify_quoted_account!
|
||||
notify_mentioned_accounts!
|
||||
notify_about_update! if update?
|
||||
end
|
||||
@@ -69,6 +70,12 @@ class FanOutOnWriteService < BaseService
|
||||
FeedManager.instance.push_to_home(@account, @status, update: update?) if @account.local?
|
||||
end
|
||||
|
||||
def notify_quoted_account!
|
||||
return unless @status.quote&.quoted_account&.local? && @status.quote&.accepted?
|
||||
|
||||
LocalNotificationWorker.perform_async(@status.quote.quoted_account_id, @status.quote.id, 'Quote', 'quote')
|
||||
end
|
||||
|
||||
def notify_mentioned_accounts!
|
||||
@status.active_mentions.where.not(id: @options[:silenced_account_ids] || []).joins(:account).merge(Account.local).select(:id, :account_id).reorder(nil).find_in_batches do |mentions|
|
||||
LocalNotificationWorker.push_bulk(mentions) do |mention|
|
||||
|
||||
@@ -247,7 +247,7 @@ class NotifyService < BaseService
|
||||
end
|
||||
|
||||
def update_notification_request!
|
||||
return unless @notification.type == :mention
|
||||
return unless %i(mention quote).include?(@notification.type)
|
||||
|
||||
notification_request = NotificationRequest.find_or_initialize_by(account_id: @recipient.id, from_account_id: @notification.from_account_id)
|
||||
notification_request.last_status_id = @notification.target_status.id
|
||||
|
||||
Reference in New Issue
Block a user