More smoke testing, I believe the stability is passable now
parent
e37c5a967a
commit
7dc114f589
|
@ -9,17 +9,8 @@ module WellKnown
|
||||||
def show
|
def show
|
||||||
@account = Account.find_local!(username_from_resource)
|
@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
|
expires_in 3.days, public: true
|
||||||
|
render json: @account, serializer: WebfingerSErializer, content_type: 'application/jrd+json'
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
head 404
|
head 404
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,8 +26,6 @@ class WebfingerSerializer < ActiveModel::Serializer
|
||||||
else
|
else
|
||||||
[
|
[
|
||||||
{ rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: short_account_url(object) },
|
{ 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) },
|
{ rel: 'self', type: 'application/activity+json', href: account_url(object) },
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,7 @@ class AfterBlockDomainFromAccountService < BaseService
|
||||||
def reject_follow!(follow)
|
def reject_follow!(follow)
|
||||||
follow.destroy
|
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)
|
ActivityPub::DeliveryWorker.perform_async(Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), @account.id, follow.account.inbox_url)
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class AuthorizeFollowService < BaseService
|
||||||
follow_request.authorize!
|
follow_request.authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
create_notification(follow_request) if !source_account.local? && source_account.activitypub?
|
create_notification(follow_request) if !source_account.local?
|
||||||
follow_request
|
follow_request
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class BlockService < BaseService
|
||||||
block = account.block!(target_account)
|
block = account.block!(target_account)
|
||||||
|
|
||||||
BlockWorker.perform_async(account.id, target_account.id)
|
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
|
block
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class FollowService < BaseService
|
||||||
target_account = ResolveAccountService.new.call(target_account, skip_webfinger: true)
|
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 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?
|
target_account.mark_known! unless !Setting.auto_mark_known || target_account.known?
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class FollowService < BaseService
|
||||||
|
|
||||||
if target_account.local?
|
if target_account.local?
|
||||||
LocalNotificationWorker.perform_async(target_account.id, follow_request.id, follow_request.class.name)
|
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)
|
ActivityPub::DeliveryWorker.perform_async(build_json(follow_request), source_account.id, target_account.inbox_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class RejectFollowService < BaseService
|
||||||
def call(source_account, target_account)
|
def call(source_account, target_account)
|
||||||
follow_request = FollowRequest.find_by!(account: source_account, target_account: target_account)
|
follow_request = FollowRequest.find_by!(account: source_account, target_account: target_account)
|
||||||
follow_request.reject!
|
follow_request.reject!
|
||||||
create_notification(follow_request) if !source_account.local? && source_account.activitypub?
|
create_notification(follow_request) if !source_account.local?
|
||||||
follow_request
|
follow_request
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class ResolveAccountService < BaseService
|
||||||
if lock.acquired?
|
if lock.acquired?
|
||||||
@account = Account.find_remote(@username, @domain)
|
@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)
|
@account = ActivityPub::ProcessAccountService.new.call(@username, @domain, actor_json)
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,7 +7,7 @@ class UnblockService < BaseService
|
||||||
return unless account.blocking?(target_account)
|
return unless account.blocking?(target_account)
|
||||||
|
|
||||||
unblock = account.unblock!(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
|
unblock
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class UnfavouriteService < BaseService
|
||||||
def call(account, status)
|
def call(account, status)
|
||||||
favourite = Favourite.find_by!(account: account, status: status)
|
favourite = Favourite.find_by!(account: account, status: status)
|
||||||
favourite.destroy!
|
favourite.destroy!
|
||||||
create_notification(favourite) if !status.account.local? && status.account.activitypub?
|
create_notification(favourite) if !status.account.local?
|
||||||
favourite
|
favourite
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ class UnfollowService < BaseService
|
||||||
return unless follow
|
return unless follow
|
||||||
|
|
||||||
follow.destroy!
|
follow.destroy!
|
||||||
create_notification(follow) if !@target_account.local? && @target_account.activitypub?
|
create_notification(follow) if !@target_account.local?
|
||||||
create_reject_notification(follow) if @target_account.local? && !@source_account.local? && @source_account.activitypub?
|
create_reject_notification(follow) if @target_account.local? && !@source_account.local?
|
||||||
UnmergeWorker.perform_async(@target_account.id, @source_account.id)
|
UnmergeWorker.perform_async(@target_account.id, @source_account.id)
|
||||||
follow
|
follow
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue