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.
21 lines
508 B
21 lines
508 B
# frozen_string_literal: true
|
|
|
|
class HashtagQueryService < BaseService
|
|
def call(tag, params, account = nil, local = false)
|
|
tags = tags_for(Array(tag.name) | Array(params[:any])).pluck(:id)
|
|
all = tags_for(params[:all])
|
|
none = tags_for(params[:none])
|
|
|
|
Status.distinct
|
|
.as_tag_timeline(tags, account, local)
|
|
.tagged_with_all(all)
|
|
.tagged_with_none(none)
|
|
end
|
|
|
|
private
|
|
|
|
def tags_for(tags)
|
|
Tag.where(name: tags.map(&:downcase)) if tags.presence
|
|
end
|
|
end
|