diff options
author | pluralcafe-docker <git@plural.cafe> | 2019-01-21 04:35:29 +0000 |
---|---|---|
committer | pluralcafe-docker <git@plural.cafe> | 2019-01-21 04:35:29 +0000 |
commit | b7c67605d5c2110b4a3cd3d8a7b8ef2878cbfe48 (patch) | |
tree | a3344b6105b7771983f69c789fb2f7a0c22a8583 /app/services/unfollow_service.rb | |
parent | fb7ec403227690f897a9a693f2461b94bf7e2582 (diff) | |
parent | aa362ab73dc7121104b3c01800152b9fc56ea396 (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/services/unfollow_service.rb')
-rw-r--r-- | app/services/unfollow_service.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/unfollow_service.rb b/app/services/unfollow_service.rb index 03e45912d..95da2a667 100644 --- a/app/services/unfollow_service.rb +++ b/app/services/unfollow_service.rb @@ -20,6 +20,7 @@ class UnfollowService < BaseService follow.destroy! create_notification(follow) unless @target_account.local? + create_reject_notification(follow) if @target_account.local? && !@source_account.local? UnmergeWorker.perform_async(@target_account.id, @source_account.id) follow end @@ -42,6 +43,12 @@ class UnfollowService < BaseService end end + def create_reject_notification(follow) + # Rejecting an already-existing follow request + return unless follow.account.activitypub? + ActivityPub::DeliveryWorker.perform_async(build_reject_json(follow), follow.target_account_id, follow.account.inbox_url) + end + def build_json(follow) ActiveModelSerializers::SerializableResource.new( follow, @@ -50,6 +57,14 @@ class UnfollowService < BaseService ).to_json end + def build_reject_json(follow) + ActiveModelSerializers::SerializableResource.new( + follow, + serializer: ActivityPub::RejectFollowSerializer, + adapter: ActivityPub::Adapter + ).to_json + end + def build_xml(follow) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.unfollow_salmon(follow)) end |