The code powering m.abunchtell.com https://m.abunchtell.com
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

22 rindas
592 B

  1. # frozen_string_literal: true
  2. class ProcessHashtagsService < BaseService
  3. def call(status, tags = [])
  4. tags = Extractor.extract_hashtags(status.text) if status.local?
  5. records = []
  6. Tag.find_or_create_by_names(tags) do |tag|
  7. status.tags << tag
  8. records << tag
  9. TrendingTags.record_use!(tag, status.account, status.created_at) if status.public_visibility?
  10. end
  11. return unless status.distributable?
  12. status.account.featured_tags.where(tag_id: records.map(&:id)).each do |featured_tag|
  13. featured_tag.increment(status.created_at)
  14. end
  15. end
  16. end