about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-08-03 13:58:03 -0500
committermultiple creatures <dev@multiple-creature.party>2019-08-03 13:58:03 -0500
commit1785c93da7a0374b7109551e59c0cb29d149e8fc (patch)
tree9492e2cb250de3ebc8c305461484a449f50b5fd3 /app/lib
parentb644f1c5050c96fd95b573cac1f406e6d85446c9 (diff)
add `noreplies`, `parent:close`, `thread:close` bangtags
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/bangtags.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index 6946bcf9e..9c5d0b3f3 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -331,6 +331,14 @@ class Bangtags
                 end
               end
             end
+          when 'noreplies', 'noats', 'close'
+            next if status.conversation_id.nil?
+            roars = Status.where(conversation_id: status.conversation_id, account_id: @account.id)
+            roars.each do |roar|
+              roar.reject_replies = true
+              roar.save
+              Rails.cache.delete("statuses/#{roar.id}")
+            end
           end
         when 'parent'
           chunk = nil
@@ -367,6 +375,10 @@ class Bangtags
             plain = ActionController::Base.helpers.strip_tags(plain)
             plain.gsub!(/ dot /i, '.')
             chunk = plain.scan(/[\w\-]+\.[\w\-]+(?:\.[\w\-]+)*/).uniq.join(' ')
+          when 'noreplies', 'noats', 'close'
+            @parent_status.reject_replies = true
+            @parent_status.save
+            Rails.cache.delete("statuses/#{@parent_status.id}")
           end
         when 'media'
           chunk = nil
@@ -589,6 +601,9 @@ class Bangtags
               status.local_only = true
             end
           end
+        when 'noreplies', 'noats'
+          chunk = nil
+          @status.reject_replies = true
         when 'live', 'lifespan', 'l', 'delete_in'
           chunk = nil
           next if cmd[1].nil?