mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
3dcb5fa28f
* selectively Revert "Fix regressions from #2683 (#2970)" This reverts commit72698bc3b4
. * Revert "Handle hashtags in spoiler_texts (partial fix for #699) (#2683)" This reverts commite2491680e6
.
14 lines
404 B
Ruby
14 lines
404 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ProcessHashtagsService < BaseService
|
|
def call(status, tags = [])
|
|
tags = status.text.scan(Tag::HASHTAG_RE).map(&:first) if status.local?
|
|
|
|
tags.map { |str| str.mb_chars.downcase }.uniq(&:to_s).each do |tag|
|
|
status.tags << Tag.where(name: tag).first_or_initialize(name: tag)
|
|
end
|
|
|
|
status.update(sensitive: true) if tags.include?('nsfw')
|
|
end
|
|
end
|