Change hashtags to preserve first-used casing (#11416)
This commit is contained in:
parent
4cc29eb5ad
commit
f371b32137
6 changed files with 54 additions and 19 deletions
|
@ -148,12 +148,9 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
def process_hashtag(tag)
|
||||
return if tag['name'].blank?
|
||||
|
||||
hashtag = tag['name'].gsub(/\A#/, '').mb_chars.downcase
|
||||
hashtag = Tag.where(name: hashtag).first_or_create!(name: hashtag)
|
||||
|
||||
return if @tags.include?(hashtag)
|
||||
|
||||
@tags << hashtag
|
||||
Tag.find_or_create_by_names(tag['name']) do |hashtag|
|
||||
@tags << hashtag unless @tags.include?(hashtag)
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue