Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
FIX: better solution for setting a required field for send_message
Dieser Commit ist enthalten in:
Ursprung
f1ea4159f5
Commit
d1b4a96e2c
2 geänderte Dateien mit 14 neuen und 9 gelöschten Zeilen
|
@ -143,6 +143,17 @@
|
|||
{{/if}}
|
||||
|
||||
{{#if sendMessage}}
|
||||
<div class="setting">
|
||||
<div class="setting-label">
|
||||
<h3>{{i18n 'admin.wizard.required'}}</h3>
|
||||
</div>
|
||||
<div class="setting-value">
|
||||
{{combo-box content=availableFields
|
||||
nameProperty='label'
|
||||
none='admin.wizard.select_field'
|
||||
value=action.required}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="setting">
|
||||
<div class="setting-label">
|
||||
<h3>{{i18n "admin.wizard.action.send_message.recipient"}}</h3>
|
||||
|
|
|
@ -423,15 +423,9 @@ class CustomWizard::Builder
|
|||
|
||||
def send_message(user, action, data)
|
||||
|
||||
empty_data = false
|
||||
|
||||
data.each do |k, v|
|
||||
if v.empty?
|
||||
empty_data = true
|
||||
if action['required'].present? && data[action['required']].blank?
|
||||
return
|
||||
end
|
||||
end
|
||||
# leave if there are any empty fields
|
||||
return if empty_data
|
||||
|
||||
if action['custom_title_enabled']
|
||||
title = CustomWizard::Builder.fill_placeholders(action['custom_title'], user, data)
|
||||
|
|
Laden …
In neuem Issue referenzieren