mastodon/app/services/process_hashtags_service.rb

12 lines
298 B
Ruby
Raw Normal View History

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