This repository has been archived on 2024-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
2016-11-15 10:56:29 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-05 10:20:05 -04:00
|
|
|
class ProcessHashtagsService < BaseService
|
|
|
|
def call(status, tags = [])
|
2017-05-19 14:19:14 -04:00
|
|
|
tags = Extractor.extract_hashtags(status.text) if status.local?
|
2016-11-05 10:20:05 -04:00
|
|
|
|
2018-05-27 15:45:30 -04:00
|
|
|
tags.map { |str| str.mb_chars.downcase }.uniq(&:to_s).each do |name|
|
|
|
|
tag = Tag.where(name: name).first_or_create(name: name)
|
|
|
|
status.tags << tag
|
2018-05-31 10:47:28 -04:00
|
|
|
TrendingTags.record_use!(tag, status.account, status.created_at) if status.public_visibility?
|
2016-11-05 10:20:05 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|