mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-21 12:05:07 +01:00
80e02b90e4
Filters out hidden stream entries from Atom feed Blocks now generate hidden stream entries, can be used to federate blocks Private statuses cannot be reblogged (generates generic 422 error for now) POST /api/v1/statuses now takes visibility=(public|unlisted|private) param instead of unlisted boolean Statuses JSON now contains visibility=(public|unlisted|private) field
31 lines
898 B
Ruby
31 lines
898 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ReblogService < BaseService
|
|
# Reblog a status and notify its remote author
|
|
# @param [Account] account Account to reblog from
|
|
# @param [Status] reblogged_status Status to be reblogged
|
|
# @return [Status]
|
|
def call(account, reblogged_status)
|
|
raise ActiveRecord::RecordInvalid if reblogged_status.private_visibility?
|
|
|
|
reblog = account.statuses.create!(reblog: reblogged_status, text: '')
|
|
|
|
DistributionWorker.perform_async(reblog.id)
|
|
Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id)
|
|
|
|
if reblogged_status.local?
|
|
NotifyService.new.call(reblogged_status.account, reblog)
|
|
else
|
|
NotificationWorker.perform_async(reblog.stream_entry.id, reblogged_status.account_id)
|
|
end
|
|
|
|
reblog
|
|
end
|
|
|
|
private
|
|
|
|
def send_interaction_service
|
|
@send_interaction_service ||= SendInteractionService.new
|
|
end
|
|
end
|