`PostStatusService`: Add options to set a specific creation time and whether or not to distribute, useful for importing statuses.
parent
24a59d8f58
commit
a680595ecb
|
@ -11,6 +11,7 @@ class PostStatusService < BaseService
|
||||||
# @option [String] :text Message
|
# @option [String] :text Message
|
||||||
# @option [Status] :thread Optional status to reply to
|
# @option [Status] :thread Optional status to reply to
|
||||||
# @option [Tag] :tags Optional tags to include
|
# @option [Tag] :tags Optional tags to include
|
||||||
|
# @option [Time] :created_at Optional time which status was originally posted
|
||||||
# @option [Boolean] :sensitive
|
# @option [Boolean] :sensitive
|
||||||
# @option [String] :visibility
|
# @option [String] :visibility
|
||||||
# @option [Boolean] :local_only
|
# @option [Boolean] :local_only
|
||||||
|
@ -107,9 +108,9 @@ class PostStatusService < BaseService
|
||||||
|
|
||||||
def postprocess_status!
|
def postprocess_status!
|
||||||
LinkCrawlWorker.perform_async(@status.id) unless @status.spoiler_text?
|
LinkCrawlWorker.perform_async(@status.id) unless @status.spoiler_text?
|
||||||
DistributionWorker.perform_async(@status.id)
|
DistributionWorker.perform_async(@status.id) unless @options[:distribute] == false
|
||||||
|
|
||||||
unless @status.local_only?
|
unless @status.local_only? || @options[:distribute] == false || @options[:federate] == false
|
||||||
ActivityPub::DistributionWorker.perform_async(@status.id)
|
ActivityPub::DistributionWorker.perform_async(@status.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -175,6 +176,7 @@ class PostStatusService < BaseService
|
||||||
|
|
||||||
def status_attributes
|
def status_attributes
|
||||||
{
|
{
|
||||||
|
created_at: @options[:created_at] ? @options[:created_at].to_datetime : Time.now.utc,
|
||||||
text: @text,
|
text: @text,
|
||||||
media_attachments: @media || [],
|
media_attachments: @media || [],
|
||||||
thread: @in_reply_to,
|
thread: @in_reply_to,
|
||||||
|
|
Loading…
Reference in New Issue