Add reference api
This commit is contained in:
parent
2d1415808b
commit
ccfa297d7b
2 changed files with 8 additions and 0 deletions
|
@ -147,6 +147,7 @@ class Api::V1::StatusesController < Api::BaseController
|
||||||
:language,
|
:language,
|
||||||
:markdown,
|
:markdown,
|
||||||
:scheduled_at,
|
:scheduled_at,
|
||||||
|
:status_reference_ids,
|
||||||
allowed_mentions: [],
|
allowed_mentions: [],
|
||||||
media_ids: [],
|
media_ids: [],
|
||||||
media_attributes: [
|
media_attributes: [
|
||||||
|
|
|
@ -17,6 +17,7 @@ class UpdateStatusService < BaseService
|
||||||
# @option options [Boolean] :sensitive
|
# @option options [Boolean] :sensitive
|
||||||
# @option options [Boolean] :markdown
|
# @option options [Boolean] :markdown
|
||||||
# @option options [String] :language
|
# @option options [String] :language
|
||||||
|
# @option [Enumerable] :status_reference_ids Optional array
|
||||||
def call(status, account_id, options = {})
|
def call(status, account_id, options = {})
|
||||||
@status = status
|
@status = status
|
||||||
@options = options
|
@options = options
|
||||||
|
@ -36,6 +37,7 @@ class UpdateStatusService < BaseService
|
||||||
|
|
||||||
queue_poll_notifications!
|
queue_poll_notifications!
|
||||||
reset_preview_card!
|
reset_preview_card!
|
||||||
|
update_references!
|
||||||
update_metadata!
|
update_metadata!
|
||||||
broadcast_updates!
|
broadcast_updates!
|
||||||
|
|
||||||
|
@ -139,6 +141,11 @@ class UpdateStatusService < BaseService
|
||||||
LinkCrawlWorker.perform_async(@status.id)
|
LinkCrawlWorker.perform_async(@status.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_references!
|
||||||
|
reference_ids = (@options[:status_reference_ids] || []).map(&:to_i).filter(&:positive?)
|
||||||
|
ProcessReferencesWorker.perform_async(@status.id, reference_ids, [])
|
||||||
|
end
|
||||||
|
|
||||||
def update_metadata!
|
def update_metadata!
|
||||||
ProcessHashtagsService.new.call(@status)
|
ProcessHashtagsService.new.call(@status)
|
||||||
ProcessMentionsService.new.call(@status)
|
ProcessMentionsService.new.call(@status)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue