0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

Add full support for groups in the private message action

Dieser Commit ist enthalten in:
Angus McLeod 2020-10-05 13:41:18 +11:00
Ursprung 1087facb54
Commit fc5279cd0a

Datei anzeigen

@ -69,13 +69,29 @@ class CustomWizard::Action
end
params = basic_topic_params
params[:target_usernames] = CustomWizard::Mapper.new(
targets = CustomWizard::Mapper.new(
inputs: action['recipient'],
data: data,
user: user
user: user,
multiple: true
).perform
targets.each do |target|
if Group.find_by(name: target)
params[:target_group_names] = target
elsif User.find_by_username(target)
params[:target_usernames] = target
else
#
end
end
if params[:title].present? && params[:raw].present? && params[:target_usernames].present?
if params[:title].present? &&
params[:raw].present? &&
(params[:target_usernames].present? ||
params[:target_group_names].present?)
params[:archetype] = Archetype.private_message
creator = PostCreator.new(user, params)