You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
298 B

7 years ago
7 years ago
  1. class ProcessHashtagsService < BaseService
  2. def call(status, tags = [])
  3. if status.local?
  4. tags = status.text.scan(Tag::HASHTAG_RE).map(&:first)
  5. end
  6. tags.map(&:downcase).uniq.each do |tag|
  7. status.tags << Tag.where(name: tag).first_or_initialize(name: tag)
  8. end
  9. end
  10. end