From ad78d28b66a0f8cf3bf7b3a6abd004ea201558b1 Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Wed, 12 Jul 2023 11:31:24 +0800 Subject: [PATCH] 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. --- app/controllers/posts_controller.rb | 36 +++++++++++------------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 42a819c3785..260d08f9dc0 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -790,20 +790,18 @@ class PostsController < ApplicationController end def create_params - permitted = [ - :raw, - :topic_id, - :archetype, - :category, - # TODO remove together with 'targetUsername' deprecations - :target_usernames, - :target_recipients, - :reply_to_post_number, - :auto_track, - :typing_duration_msecs, - :composer_open_duration_msecs, - :visible, - :draft_key, + permitted = %i[ + raw + topic_id + archetype + category + target_recipients + reply_to_post_number + auto_track + typing_duration_msecs + composer_open_duration_msecs + visible + draft_key ] Post.plugin_permitted_create_params.each do |key, value| @@ -891,15 +889,7 @@ class PostsController < ApplicationController result[:user_agent] = request.user_agent result[:referrer] = request.env["HTTP_REFERER"] - if recipients = result[:target_usernames] - 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 + recipients = result[:target_recipients] if recipients recipients = recipients.split(",").map(&:downcase)