More smoke testing, I believe the stability is passable now

master
Holly 'Frinkel' Lotor 2020-01-20 21:14:05 +00:00
parent e37c5a967a
commit 7dc114f589
11 changed files with 12 additions and 23 deletions

View File

@ -9,17 +9,8 @@ module WellKnown
def show
@account = Account.find_local!(username_from_resource)
respond_to do |format|
format.any(:json, :html) do
render json: @account, serializer: WebfingerSerializer, content_type: 'application/jrd+json'
end
format.xml do
render content_type: 'application/xrd+xml'
end
end
expires_in 3.days, public: true
render json: @account, serializer: WebfingerSErializer, content_type: 'application/jrd+json'
rescue ActiveRecord::RecordNotFound
head 404
end

View File

@ -26,8 +26,6 @@ class WebfingerSerializer < ActiveModel::Serializer
else
[
{ rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: short_account_url(object) },
# TODO: Make sure commenting the next line doesn't cause other instances to catch on fire
# { rel: 'http://schemas.google.com/g/2010#updates-from', type: 'application/atom+xml', href: account_url(object, format: 'atom') },
{ rel: 'self', type: 'application/activity+json', href: account_url(object) },
]
end

View File

@ -31,7 +31,7 @@ class AfterBlockDomainFromAccountService < BaseService
def reject_follow!(follow)
follow.destroy
return unless follow.account.activitypub?
# return unless follow.account.activitypub?
ActivityPub::DeliveryWorker.perform_async(Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), @account.id, follow.account.inbox_url)
end

View File

@ -11,7 +11,7 @@ class AuthorizeFollowService < BaseService
follow_request.authorize!
end
create_notification(follow_request) if !source_account.local? && source_account.activitypub?
create_notification(follow_request) if !source_account.local?
follow_request
end

View File

@ -13,7 +13,7 @@ class BlockService < BaseService
block = account.block!(target_account)
BlockWorker.perform_async(account.id, target_account.id)
create_notification(block) if !target_account.local? && target_account.activitypub?
create_notification(block) if !target_account.local?
block
end

View File

@ -13,7 +13,7 @@ class FollowService < BaseService
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? || (!target_account.local? && target_account.ostatus?)
raise Mastodon::NotPermittedError if target_account.blocking?(source_account) || source_account.blocking?(target_account) || target_account.moved?
target_account.mark_known! unless !Setting.auto_mark_known || target_account.known?
@ -52,7 +52,7 @@ class FollowService < BaseService
if target_account.local?
LocalNotificationWorker.perform_async(target_account.id, follow_request.id, follow_request.class.name)
elsif target_account.activitypub?
else
ActivityPub::DeliveryWorker.perform_async(build_json(follow_request), source_account.id, target_account.inbox_url)
end

View File

@ -6,7 +6,7 @@ class RejectFollowService < BaseService
def call(source_account, target_account)
follow_request = FollowRequest.find_by!(account: source_account, target_account: target_account)
follow_request.reject!
create_notification(follow_request) if !source_account.local? && source_account.activitypub?
create_notification(follow_request) if !source_account.local?
follow_request
end

View File

@ -93,7 +93,7 @@ class ResolveAccountService < BaseService
if lock.acquired?
@account = Account.find_remote(@username, @domain)
next if (@account.present? && !@account.activitypub?) || actor_json.nil?
next if @account.present? || actor_json.nil?
@account = ActivityPub::ProcessAccountService.new.call(@username, @domain, actor_json)
else

View File

@ -7,7 +7,7 @@ class UnblockService < BaseService
return unless account.blocking?(target_account)
unblock = account.unblock!(target_account)
create_notification(unblock) if !target_account.local? && target_account.activitypub?
create_notification(unblock) if !target_account.local?
unblock
end

View File

@ -6,7 +6,7 @@ class UnfavouriteService < BaseService
def call(account, status)
favourite = Favourite.find_by!(account: account, status: status)
favourite.destroy!
create_notification(favourite) if !status.account.local? && status.account.activitypub?
create_notification(favourite) if !status.account.local?
favourite
end

View File

@ -21,8 +21,8 @@ class UnfollowService < BaseService
return unless follow
follow.destroy!
create_notification(follow) if !@target_account.local? && @target_account.activitypub?
create_reject_notification(follow) if @target_account.local? && !@source_account.local? && @source_account.activitypub?
create_notification(follow) if !@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