This repository has been archived on 2019-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/app/services/process_hashtags_service.rb
2016-11-05 22:09:51 +01:00

12 lines
298 B
Ruby

class ProcessHashtagsService < BaseService
def call(status, tags = [])
if status.local?
tags = status.text.scan(Tag::HASHTAG_RE).map(&:first)
end
tags.map(&:downcase).uniq.each do |tag|
status.tags << Tag.where(name: tag).first_or_initialize(name: tag)
end
end
end