DEV: Remove deprecated target_usernames param from PostsController#create (#22561)

The parameter target_usernames was replaced by target_recipients a while back, and was marked for removal in 2.9.0. This change removes it.
This commit is contained in:
Ted Johansson 2023-07-12 11:31:24 +08:00 committed by GitHub
parent 0106c9b4ca
commit ad78d28b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 23 deletions

View File

@ -790,20 +790,18 @@ class PostsController < ApplicationController
end end
def create_params def create_params
permitted = [ permitted = %i[
:raw, raw
:topic_id, topic_id
:archetype, archetype
:category, category
# TODO remove together with 'targetUsername' deprecations target_recipients
:target_usernames, reply_to_post_number
:target_recipients, auto_track
:reply_to_post_number, typing_duration_msecs
:auto_track, composer_open_duration_msecs
:typing_duration_msecs, visible
:composer_open_duration_msecs, draft_key
:visible,
:draft_key,
] ]
Post.plugin_permitted_create_params.each do |key, value| Post.plugin_permitted_create_params.each do |key, value|
@ -891,15 +889,7 @@ class PostsController < ApplicationController
result[:user_agent] = request.user_agent result[:user_agent] = request.user_agent
result[:referrer] = request.env["HTTP_REFERER"] result[:referrer] = request.env["HTTP_REFERER"]
if recipients = result[:target_usernames] recipients = result[:target_recipients]
Discourse.deprecate(
"`target_usernames` is deprecated, use `target_recipients` instead.",
output_in_test: true,
drop_from: "2.9.0",
)
else
recipients = result[:target_recipients]
end
if recipients if recipients
recipients = recipients.split(",").map(&:downcase) recipients = recipients.split(",").map(&:downcase)