0
0
Fork 0

Change hashtags to preserve first-used casing (#11416)

This commit is contained in:
Eugen Rochko 2019-07-28 05:59:51 +02:00 committed by GitHub
parent 4cc29eb5ad
commit f371b32137
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 19 deletions

View file

@ -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