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}}
|
||||||
|
|
||||||
{{#if sendMessage}}
|
{{#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">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<h3>{{i18n "admin.wizard.action.send_message.recipient"}}</h3>
|
<h3>{{i18n "admin.wizard.action.send_message.recipient"}}</h3>
|
||||||
|
|
|
@ -423,16 +423,10 @@ class CustomWizard::Builder
|
||||||
|
|
||||||
def send_message(user, action, data)
|
def send_message(user, action, data)
|
||||||
|
|
||||||
empty_data = false
|
if action['required'].present? && data[action['required']].blank?
|
||||||
|
return
|
||||||
data.each do |k, v|
|
|
||||||
if v.empty?
|
|
||||||
empty_data = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
# leave if there are any empty fields
|
|
||||||
return if empty_data
|
|
||||||
|
|
||||||
if action['custom_title_enabled']
|
if action['custom_title_enabled']
|
||||||
title = CustomWizard::Builder.fill_placeholders(action['custom_title'], user, data)
|
title = CustomWizard::Builder.fill_placeholders(action['custom_title'], user, data)
|
||||||
else
|
else
|
||||||
|
|
Laden …
In neuem Issue referenzieren