Ignore multiple occurrences of a hashtag within a status (fixes #7585) (#7606)

lolsob-rspec
ThibG 2018-05-25 14:26:45 +02:00 committed by Eugen Rochko
parent 6d50785928
commit d1b2466320
1 changed files with 1 additions and 1 deletions

View File

@ -80,7 +80,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
hashtag = tag['name'].gsub(/\A#/, '').mb_chars.downcase hashtag = tag['name'].gsub(/\A#/, '').mb_chars.downcase
hashtag = Tag.where(name: hashtag).first_or_initialize(name: hashtag) hashtag = Tag.where(name: hashtag).first_or_initialize(name: hashtag)
status.tags << hashtag status.tags << hashtag unless status.tags.include?(hashtag)
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
nil nil
end end