mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
DEV: Modifier to add params to TopicsController redirect url (#26470)
This commit is contained in:

committed by
GitHub

parent
51006b5591
commit
797ab30d95
@ -1255,7 +1255,19 @@ class TopicsController < ApplicationController
|
||||
raise(SiteSetting.detailed_404 ? ex : Discourse::NotFound)
|
||||
end
|
||||
|
||||
opts = params.slice(:page, :print, :filter_top_level_replies, :preview_theme_id)
|
||||
# Allow plugins to append allowed query parameters, so they aren't scrubbed on redirect to proper topic URL
|
||||
additional_allowed_query_parameters =
|
||||
DiscoursePluginRegistry.apply_modifier(
|
||||
:redirect_to_correct_topic_additional_query_parameters,
|
||||
[],
|
||||
)
|
||||
|
||||
opts =
|
||||
params.slice(
|
||||
*%i[page print filter_top_level_replies preview_theme_id].concat(
|
||||
additional_allowed_query_parameters,
|
||||
),
|
||||
)
|
||||
opts.delete(:page) if params[:page] == 0
|
||||
|
||||
url = topic.relative_url
|
||||
|
Reference in New Issue
Block a user