Fix hashtag timeline REST API accepting too many hashtags (#12091)
This commit is contained in:
parent
6b96a6dd15
commit
b665e99b2f
1 changed files with 3 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class HashtagQueryService < BaseService
|
class HashtagQueryService < BaseService
|
||||||
|
LIMIT_PER_MODE = 4
|
||||||
|
|
||||||
def call(tag, params, account = nil, local = false)
|
def call(tag, params, account = nil, local = false)
|
||||||
tags = tags_for(Array(tag.name) | Array(params[:any])).pluck(:id)
|
tags = tags_for(Array(tag.name) | Array(params[:any])).pluck(:id)
|
||||||
all = tags_for(params[:all])
|
all = tags_for(params[:all])
|
||||||
|
@ -15,6 +17,6 @@ class HashtagQueryService < BaseService
|
||||||
private
|
private
|
||||||
|
|
||||||
def tags_for(names)
|
def tags_for(names)
|
||||||
Tag.matching_name(names) if names.presence
|
Tag.matching_name(Array(names).take(LIMIT_PER_MODE)) if names.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue