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

12 lines
293 B
Ruby
Raw Normal View History

2016-11-05 14:20:05 +00:00
class ProcessHashtagsService < BaseService
def call(status, tags = [])
if status.local?
tags = status.text.scan(Tag::HASHTAG_RE).map(&:first)
end
tags.map(&:downcase).each do |tag|
status.tags << Tag.where(name: tag).first_or_initialize(name: tag)
end
end
end