Merge branch 'origin/master' into sync/upstream
Conflicts: app/javascript/mastodon/components/status_list.js app/javascript/mastodon/features/notifications/index.js app/javascript/mastodon/features/ui/components/modal_root.js app/javascript/mastodon/features/ui/components/onboarding_modal.js app/javascript/mastodon/features/ui/index.js app/javascript/styles/about.scss app/javascript/styles/accounts.scss app/javascript/styles/components.scss app/presenters/instance_presenter.rb app/services/post_status_service.rb app/services/reblog_service.rb app/views/about/more.html.haml app/views/about/show.html.haml app/views/accounts/_header.html.haml config/webpack/loaders/babel.js spec/controllers/api/v1/accounts/credentials_controller_spec.rb
This commit is contained in:
@@ -20,17 +20,35 @@ class ReblogService < BaseService
|
||||
reblog = account.statuses.create!(reblog: reblogged_status, text: '')
|
||||
|
||||
DistributionWorker.perform_async(reblog.id)
|
||||
|
||||
unless /👁$/.match?(reblogged_status.content)
|
||||
Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id)
|
||||
ActivityPub::DistributionWorker.perform_async(reblog.id)
|
||||
end
|
||||
|
||||
|
||||
if reblogged_status.local?
|
||||
NotifyService.new.call(reblog.reblog.account, reblog)
|
||||
else
|
||||
NotificationWorker.perform_async(stream_entry_to_xml(reblog.stream_entry), account.id, reblog.reblog.account_id)
|
||||
end
|
||||
|
||||
create_notification(reblog)
|
||||
reblog
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_notification(reblog)
|
||||
reblogged_status = reblog.reblog
|
||||
|
||||
if reblogged_status.account.local?
|
||||
NotifyService.new.call(reblogged_status.account, reblog)
|
||||
elsif reblogged_status.account.ostatus?
|
||||
NotificationWorker.perform_async(stream_entry_to_xml(reblog.stream_entry), reblog.account_id, reblogged_status.account_id)
|
||||
elsif reblogged_status.account.activitypub? && !reblogged_status.account.following?(reblog.account)
|
||||
ActivityPub::DeliveryWorker.perform_async(build_json(reblog), reblog.account_id, reblogged_status.account.inbox_url)
|
||||
end
|
||||
end
|
||||
|
||||
def build_json(reblog)
|
||||
Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(
|
||||
reblog,
|
||||
serializer: ActivityPub::ActivitySerializer,
|
||||
adapter: ActivityPub::Adapter
|
||||
).as_json).sign!(reblog.account))
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user