Skip to content

Commit

Permalink
Add error when trying to follow OStatus accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Jun 29, 2019
1 parent 11f794a commit 46d51b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/services/follow_service.rb
Expand Up @@ -13,7 +13,7 @@ def call(source_account, target_account, reblogs: nil)
target_account = ResolveAccountService.new.call(target_account, skip_webfinger: true)

raise ActiveRecord::RecordNotFound if target_account.nil? || target_account.id == source_account.id || target_account.suspended?
raise Mastodon::NotPermittedError if target_account.blocking?(source_account) || source_account.blocking?(target_account) || target_account.moved?
raise Mastodon::NotPermittedError if target_account.blocking?(source_account) || source_account.blocking?(target_account) || target_account.moved? || (!target_account.local? && target_account.ostatus?)

if source_account.following?(target_account)
# We're already following this account, but we'll call follow! again to
Expand Down
6 changes: 2 additions & 4 deletions app/services/unblock_service.rb
Expand Up @@ -7,16 +7,14 @@ def call(account, target_account)
return unless account.blocking?(target_account)

unblock = account.unblock!(target_account)
create_notification(unblock) unless target_account.local?
create_notification(unblock) if !target_account.local? && target_account.activitypub?
unblock
end

private

def create_notification(unblock)
if unblock.target_account.activitypub?
ActivityPub::DeliveryWorker.perform_async(build_json(unblock), unblock.account_id, unblock.target_account.inbox_url)
end
ActivityPub::DeliveryWorker.perform_async(build_json(unblock), unblock.account_id, unblock.target_account.inbox_url)
end

def build_json(unblock)
Expand Down

0 comments on commit 46d51b9

Please sign in to comment.