diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-05-10 10:49:27 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-05-21 03:16:23 -0500 |
commit | a680595ecb6b0d0fb1f8931585187f61c4e32874 (patch) | |
tree | 7453442e8fa1016a77aa3fd920dc95bf01b97b0d | |
parent | 24a59d8f58a55e5903496c7773184dba737f4a9a (diff) |
`PostStatusService`: Add options to set a specific creation time and whether or not to distribute, useful for importing statuses.
-rw-r--r-- | app/services/post_status_service.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 60a5cac5c..78b5fcbdb 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -11,6 +11,7 @@ class PostStatusService < BaseService # @option [String] :text Message # @option [Status] :thread Optional status to reply to # @option [Tag] :tags Optional tags to include + # @option [Time] :created_at Optional time which status was originally posted # @option [Boolean] :sensitive # @option [String] :visibility # @option [Boolean] :local_only @@ -107,9 +108,9 @@ class PostStatusService < BaseService def postprocess_status! 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) end @@ -175,6 +176,7 @@ class PostStatusService < BaseService def status_attributes { + created_at: @options[:created_at] ? @options[:created_at].to_datetime : Time.now.utc, text: @text, media_attachments: @media || [], thread: @in_reply_to, |