The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

23 lines
547 B

  1. # frozen_string_literal: true
  2. class HashtagQueryService < BaseService
  3. LIMIT_PER_MODE = 4
  4. def call(tag, params, account = nil, local = false)
  5. tags = tags_for(Array(tag.name) | Array(params[:any])).pluck(:id)
  6. all = tags_for(params[:all])
  7. none = tags_for(params[:none])
  8. Status.distinct
  9. .as_tag_timeline(tags, account, local)
  10. .tagged_with_all(all)
  11. .tagged_with_none(none)
  12. end
  13. private
  14. def tags_for(names)
  15. Tag.matching_name(Array(names).take(LIMIT_PER_MODE)) if names.present?
  16. end
  17. end