about summary refs log tree commit diff
path: root/app/services/update_status_service.rb
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-19 18:50:24 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:43:59 -0500
commit21438b54bdaf3c557ec9ebbc482a2c418d8c64f8 (patch)
treee577d047af196823227e675dea52b2fc2fa842c6 /app/services/update_status_service.rb
parent8c8ad0ac0ed0d3e67f3e521068b59edd4054f1e9 (diff)
[Feature] Add manual publishing option
Diffstat (limited to 'app/services/update_status_service.rb')
-rw-r--r--app/services/update_status_service.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb
index b393f13bb..440b99ce7 100644
--- a/app/services/update_status_service.rb
+++ b/app/services/update_status_service.rb
@@ -32,7 +32,8 @@ class UpdateStatusService < BaseService
     @tags                   = (tags.nil? ? @status.tags : (tags || [])).to_set
 
     @params[:text]        ||= ''
-    @params[:edited]      ||= 1 + @status.edited
+    @params[:published]     = true if @status.published?
+    (@params[:edited]     ||= 1 + @status.edited) if @params[:published].presence || @status.published?
 
     update_tags if @status.local?
     filter_tags
@@ -54,7 +55,7 @@ class UpdateStatusService < BaseService
     prune_attachments
     reset_status_caches
 
-    SpamCheck.perform(@status)
+    SpamCheck.perform(@status) if @status.published?
     distribute
 
     @status
@@ -132,6 +133,9 @@ class UpdateStatusService < BaseService
   def distribute
     LinkCrawlWorker.perform_in(rand(1..30).seconds, @status.id) unless @status.spoiler_text?
     DistributionWorker.perform_async(@status.id)
+
+    return unless @status.published?
+
     ActivityPub::DistributionWorker.perform_async(@status.id) if @status.local? && !@status.local_only?
 
     mentions = @status.active_mentions.includes(:account).where(id: @new_mention_ids, accounts: { domain: nil })