diff options
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/bangtags.rb | 6 |
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 |