From dd7164aac2e26426dbc82f213aa30249aae5638b Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Tue, 21 May 2019 21:20:42 -0500 Subject: handle tags with the old `:` scope delimiter but translate those to `.` --- app/models/tag.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/models') diff --git a/app/models/tag.rb b/app/models/tag.rb index a6a1445a3..d3511a54e 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -19,7 +19,7 @@ class Tag < ApplicationRecord has_many :featured_tags, dependent: :destroy, inverse_of: :tag has_one :account_tag_stat, dependent: :destroy - HASHTAG_NAME_RE = '[[:word:]._\-]*[[:alpha:]._·\-][[:word:]._\-]*' + HASHTAG_NAME_RE = '[[:word:]:._\-]*[[:alpha:]:._·\-][[:word:]:._\-]*' HASHTAG_RE = /(?:^|[^\/\)\w])#(#{HASHTAG_NAME_RE})/i validates :name, presence: true, uniqueness: true, format: { with: /\A#{HASHTAG_NAME_RE}\z/i } @@ -82,7 +82,7 @@ class Tag < ApplicationRecord end def find_normalized(name) - find_by(name: name.mb_chars.gsub(':', '.').downcase.to_s) + find_by(name: name.gsub(':', '.').mb_chars.downcase.to_s) end def find_normalized!(name) -- cgit