diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-09-13 16:01:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-13 16:01:26 +0200 |
commit | 0762258aec68f1d422a0ecdc29d637c5807f943a (patch) | |
tree | 6c084bae4eb476959b3f5a4ffff375471eb0a358 /app/models | |
parent | 59da5ccb8e9e06e0c91ebd548e899786c632f1de (diff) |
Fix hashtags being split by ZWNJ character (#11821)
Fix #11761
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/tag.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/tag.rb b/app/models/tag.rb index 135e0a030..a6aed0d68 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -25,8 +25,9 @@ class Tag < ApplicationRecord has_many :featured_tags, dependent: :destroy, inverse_of: :tag has_one :account_tag_stat, dependent: :destroy - HASHTAG_NAME_RE = '([[:word:]_][[:word:]_·]*[[:alpha:]_·][[:word:]_·]*[[:word:]_])|([[:word:]_]*[[:alpha:]][[:word:]_]*)' - HASHTAG_RE = /(?:^|[^\/\)\w])#(#{HASHTAG_NAME_RE})/i + HASHTAG_SEPARATORS = "_\u00B7\u200c" + HASHTAG_NAME_RE = "([[:word:]_][[:word:]#{HASHTAG_SEPARATORS}]*[[:alpha:]#{HASHTAG_SEPARATORS}][[:word:]#{HASHTAG_SEPARATORS}]*[[:word:]_])|([[:word:]_]*[[:alpha:]][[:word:]_]*)" + HASHTAG_RE = /(?:^|[^\/\)\w])#(#{HASHTAG_NAME_RE})/i validates :name, presence: true, format: { with: /\A(#{HASHTAG_NAME_RE})\z/i } validate :validate_name_change, if: -> { !new_record? && name_changed? } |