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:
Ursprung
1087facb54
Commit
fc5279cd0a
1 geänderte Dateien mit 19 neuen und 3 gelöschten Zeilen
|
@ -69,13 +69,29 @@ class CustomWizard::Action
|
||||||
end
|
end
|
||||||
|
|
||||||
params = basic_topic_params
|
params = basic_topic_params
|
||||||
params[:target_usernames] = CustomWizard::Mapper.new(
|
|
||||||
|
targets = CustomWizard::Mapper.new(
|
||||||
inputs: action['recipient'],
|
inputs: action['recipient'],
|
||||||
data: data,
|
data: data,
|
||||||
user: user
|
user: user,
|
||||||
|
multiple: true
|
||||||
).perform
|
).perform
|
||||||
|
|
||||||
if params[:title].present? && params[:raw].present? && params[:target_usernames].present?
|
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? ||
|
||||||
|
params[:target_group_names].present?)
|
||||||
|
|
||||||
params[:archetype] = Archetype.private_message
|
params[:archetype] = Archetype.private_message
|
||||||
|
|
||||||
creator = PostCreator.new(user, params)
|
creator = PostCreator.new(user, params)
|
||||||
|
|
Laden …
In neuem Issue referenzieren