0
0
Fork 0

Fix duplicate notifications being possible after poll expiration (#17697)

This commit is contained in:
Eugen Rochko 2022-03-04 01:06:33 +01:00 committed by GitHub
parent 04c3ac896a
commit 2ea754b861
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 11 deletions

View file

@ -35,7 +35,7 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity
def distribute
# Notify the author of the original status if that status is local
NotifyService.new.call(@status.reblog.account, :reblog, @status) if reblog_of_local_account?(@status) && !reblog_by_following_group_account?(@status)
LocalNotificationWorker.perform_async(@status.reblog.account_id, @status.id, 'Status', 'reblog') if reblog_of_local_account?(@status) && !reblog_by_following_group_account?(@status)
# Distribute into home and list feeds
::DistributionWorker.perform_async(@status.id) if @options[:override_timestamps] || @status.within_realtime_window?

View file

@ -31,10 +31,10 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
follow_request = FollowRequest.create!(account: @account, target_account: target_account, uri: @json['id'])
if target_account.locked? || @account.silenced?
NotifyService.new.call(target_account, :follow_request, follow_request)
LocalNotificationWorker.perform_async(target_account.id, follow_request.id, 'FollowRequest', 'follow_request')
else
AuthorizeFollowService.new.call(@account, target_account)
NotifyService.new.call(target_account, :follow, ::Follow.find_by(account: @account, target_account: target_account))
LocalNotificationWorker.perform_async(target_account.id, ::Follow.find_by(account: @account, target_account: target_account).id, 'Follow', 'follow')
end
end

View file

@ -8,7 +8,7 @@ class ActivityPub::Activity::Like < ActivityPub::Activity
favourite = original_status.favourites.create!(account: @account)
NotifyService.new.call(original_status.account, :favourite, favourite)
LocalNotificationWorker.perform_async(original_status.account_id, favourite.id, 'Favourite', 'favourite')
Trends.statuses.register(original_status)
end
end