mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-04-30 21:10:03 +08:00
In plenty of areas where tags are dealt with, we use `tag_id` when actually referring to `tag_name`. This is super confusing. We're making some changes to how tags are dealt with, so to prevent adding more tech debt we're fixing this confusion first.
20 lines
566 B
Ruby
20 lines
566 B
Ruby
# frozen_string_literal: true
|
|
|
|
module TopicQueryParams
|
|
def build_topic_list_options
|
|
options = {}
|
|
params[:tags] = [params[:tag_name], *Array(params[:tags])].uniq if params[:tag_name].present?
|
|
|
|
TopicQuery.public_valid_options.each do |key|
|
|
if params.key?(key) && (val = params[key]).present?
|
|
options[key] = val
|
|
raise Discourse::InvalidParameters.new key if !TopicQuery.validate?(key, val)
|
|
end
|
|
end
|
|
|
|
# hacky columns get special handling
|
|
options[:topic_ids] = param_to_integer_list(:topic_ids)
|
|
|
|
options
|
|
end
|
|
end
|