Removed unused ostatus, activitypub actions from service code
• Removed: - unused ostatus, activitypub actions from service code
This commit is contained in:
@@ -19,8 +19,6 @@ class UnfollowService < BaseService
|
||||
return unless follow
|
||||
|
||||
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
|
||||
@@ -31,41 +29,7 @@ class UnfollowService < BaseService
|
||||
return unless follow_request
|
||||
|
||||
follow_request.destroy!
|
||||
create_notification(follow_request) unless @target_account.local?
|
||||
follow_request
|
||||
end
|
||||
|
||||
def create_notification(follow)
|
||||
if follow.target_account.ostatus?
|
||||
NotificationWorker.perform_async(build_xml(follow), follow.account_id, follow.target_account_id)
|
||||
elsif follow.target_account.activitypub?
|
||||
ActivityPub::DeliveryWorker.perform_async(build_json(follow), follow.account_id, follow.target_account.inbox_url)
|
||||
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,
|
||||
serializer: ActivityPub::UndoFollowSerializer,
|
||||
adapter: ActivityPub::Adapter
|
||||
).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
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user