Added cashtag support for statuses

• Added:
- cashtag support for statuses

Ref: e23931b255
This commit is contained in:
mgabdev
2020-10-30 14:01:55 -05:00
parent 9f712198dc
commit 6db1cf421b
6 changed files with 67 additions and 18 deletions

View File

@@ -18,7 +18,8 @@ class Tag < ApplicationRecord
has_one :account_tag_stat, dependent: :destroy
HASHTAG_NAME_RE = '[[:word:]_]*[[:alpha:]_·][[:word:]_]*'
HASHTAG_RE = /(?:^|[^\/\)\w])#(#{HASHTAG_NAME_RE})/i
HASHTAG_RE = /(?:^|[^\/\)\w])#(#{HASHTAG_NAME_RE})/i.freeze
CASHTAG_RE = /(?:^|[^\/\)\w])\$([a-zA-Z]{2,5})/.freeze
validates :name, presence: true, uniqueness: true, format: { with: /\A#{HASHTAG_NAME_RE}\z/i }