mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
12 lines
298 B
Ruby
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
|