mirror of
https://github.com/mastodon/mastodon.git
synced 2024-10-20 16:46:08 +00:00
74081433d0
If a status with a hashtag becomes very popular, it stands to reason that the hashtag should have a chance at trending Fix no stats being recorded for hashtags that are not allowed to trend, and stop ignoring bots Remove references to hashtags in profile directory from the code and the admin UI
21 lines
595 B
Ruby
21 lines
595 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ProcessHashtagsService < BaseService
|
|
def call(status, tags = [])
|
|
tags = Extractor.extract_hashtags(status.text) if status.local?
|
|
records = []
|
|
|
|
Tag.find_or_create_by_names(tags) do |tag|
|
|
status.tags << tag
|
|
records << tag
|
|
tag.use!(status.account, status: status, at_time: status.created_at) if status.public_visibility?
|
|
end
|
|
|
|
return unless status.distributable?
|
|
|
|
status.account.featured_tags.where(tag_id: records.map(&:id)).each do |featured_tag|
|
|
featured_tag.increment(status.created_at)
|
|
end
|
|
end
|
|
end
|