about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-02-16 03:39:53 -0600
committermultiple creatures <dev@multiple-creature.party>2020-02-16 03:39:53 -0600
commit8e307ca94dfa2281013fc29dd5e0812afaf721d0 (patch)
tree58f57dca36befaa67728719cfc8e46cf1e6478c6 /app
parent69bcd23c89d5d4dc35d6a0a52da2ac3ac4c2d500 (diff)
add `keep_hidden?` flag to make sure drafts are not accidentally published by the delayed roars feature
Diffstat (limited to 'app')
-rw-r--r--app/lib/bangtags.rb2
-rw-r--r--app/models/status.rb12
-rw-r--r--app/services/post_status_service.rb2
3 files changed, 15 insertions, 1 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index c85f4ee34..53c63bf78 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -558,7 +558,6 @@ class Bangtags
             chunk = nil
             del_tags(@parent_status, 'self.draft', 'draft')
             Bangtags.new(@parent_status).process
-            @parent_status.save
             PostStatusWorker.perform_async(@parent_status.id, hidden: false, process_mentions: true)
           end
 
@@ -708,6 +707,7 @@ class Bangtags
         when 'draft'
           chunk = nil
           @status.hidden = true
+          @status.keep_hidden!
           @vore_stack.push('_draft')
           @component_stack.push(:var)
           add_tags(status, 'self.draft')
diff --git a/app/models/status.rb b/app/models/status.rb
index a1dc37fe8..36efaf765 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -328,6 +328,18 @@ class Status < ApplicationRecord
     @no_clobber_expirations || false
   end
 
+  def keep_hidden!
+    @keep_hidden = true
+  end
+
+  def keep_unhidden!
+    @keep_hidden = false
+  end
+
+  def keep_hidden?
+    @keep_hidden || false
+  end
+
   def mark_for_mass_destruction!
     @marked_for_mass_destruction = true
   end
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index fde56238a..9e405fe1c 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -233,6 +233,8 @@ class PostStatusService < BaseService
 
     return false if @status.destroyed?
 
+    @hidden = @status.keep_hidden? if @options[:hidden].blank?
+
     set_expirations
     process_hashtags_service.call(@status, @tags, @preloaded_tags)
     process_mentions