about summary refs log tree commit diff
path: root/app/lib/bangtags.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/lib/bangtags.rb')
-rw-r--r--app/lib/bangtags.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index 1284b47e0..201ed9622 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -1001,7 +1001,7 @@ class Bangtags
     text.strip!
     text = text.split("\n").map { |chunk| chunk.strip }.join("\n") if @strip_lines
 
-    if text.blank?
+    if text.blank? || has_only_mentions?(text)
       RemoveStatusService.new.call(@status)
     else
       status.text = text
@@ -1090,6 +1090,10 @@ class Bangtags
     end
   end
 
+  def has_only_mentions?(text)
+    text.match?(/^(?:\s*@((#{Account::USERNAME_RE})(?:@[a-z0-9\.\-]+[a-z0-9]+)?))+$/i)
+  end
+
   def add_tags(to_status, *tags)
     valid_name = /^[[:word:]:._\-]*[[:alpha:]:._·\-][[:word:]:._\-]*$/
     tags = tags.select {|t| t.present? && valid_name.match?(t)}.uniq