Revert "Rename 'target usernames' with 'target recipients' in Composer (#8468)"

This reverts commit ebb288dc2c.
This commit is contained in:
Bianca Nenciu
2019-12-20 11:56:20 +02:00
parent 7030c93206
commit 9fe11d0fc3
8 changed files with 47 additions and 101 deletions
+7 -15
View File
@@ -675,9 +675,7 @@ class PostsController < ApplicationController
:topic_id,
:archetype,
:category,
# TODO remove together with 'targetUsername' deprecations
:target_usernames,
:target_recipients,
:reply_to_post_number,
:auto_track,
:typing_duration_msecs,
@@ -751,19 +749,13 @@ 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)
else
recipients = result[:target_recipients]
end
if recipients
recipients = recipients.split(",")
groups = Group.messageable(current_user).where('name in (?)', recipients).pluck('name')
recipients -= groups
emails = recipients.select { |user| user.match(/@/) }
recipients -= emails
result[:target_usernames] = recipients.join(",")
if usernames = result[:target_usernames]
usernames = usernames.split(",")
groups = Group.messageable(current_user).where('name in (?)', usernames).pluck('name')
usernames -= groups
emails = usernames.select { |user| user.match(/@/) }
usernames -= emails
result[:target_usernames] = usernames.join(",")
result[:target_emails] = emails.join(",")
result[:target_group_names] = groups.join(",")
end