forked from asonix/mastodon
* selectively Revert "Fix regressions from #2683 (#2970)" This reverts commit72698bc3b4
. * Revert "Handle hashtags in spoiler_texts (partial fix for #699) (#2683)" This reverts commite2491680e6
.
13 lines
404 B
Ruby
13 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
|