On slack,discord add support for Include hidden fields (#654)
This commit is contained in:
parent
3d9bc60ca1
commit
9a2d7b9d8d
|
|
@ -15,6 +15,7 @@ class DiscordIntegration extends AbstractIntegrationHandler
|
||||||
return [
|
return [
|
||||||
'discord_webhook_url' => 'required|url|starts_with:https://discord.com/api/webhooks',
|
'discord_webhook_url' => 'required|url|starts_with:https://discord.com/api/webhooks',
|
||||||
'include_submission_data' => 'boolean',
|
'include_submission_data' => 'boolean',
|
||||||
|
'include_hidden_fields_submission_data' => ['nullable', 'boolean'],
|
||||||
'link_open_form' => 'boolean',
|
'link_open_form' => 'boolean',
|
||||||
'link_edit_form' => 'boolean',
|
'link_edit_form' => 'boolean',
|
||||||
'views_submissions_count' => 'boolean',
|
'views_submissions_count' => 'boolean',
|
||||||
|
|
@ -34,10 +35,14 @@ class DiscordIntegration extends AbstractIntegrationHandler
|
||||||
|
|
||||||
protected function getWebhookData(): array
|
protected function getWebhookData(): array
|
||||||
{
|
{
|
||||||
|
$settings = (array) $this->integrationData ?? [];
|
||||||
|
|
||||||
$formatter = (new FormSubmissionFormatter($this->form, $this->submissionData))->outputStringsOnly();
|
$formatter = (new FormSubmissionFormatter($this->form, $this->submissionData))->outputStringsOnly();
|
||||||
|
if (Arr::get($settings, 'include_hidden_fields_submission_data', false)) {
|
||||||
|
$formatter->showHiddenFields();
|
||||||
|
}
|
||||||
$formattedData = $formatter->getFieldsWithValue();
|
$formattedData = $formatter->getFieldsWithValue();
|
||||||
|
|
||||||
$settings = (array) $this->integrationData ?? [];
|
|
||||||
$externalLinks = [];
|
$externalLinks = [];
|
||||||
if (Arr::get($settings, 'link_open_form', true)) {
|
if (Arr::get($settings, 'link_open_form', true)) {
|
||||||
$externalLinks[] = '[**🔗 Open Form**](' . $this->form->share_url . ')';
|
$externalLinks[] = '[**🔗 Open Form**](' . $this->form->share_url . ')';
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ class SlackIntegration extends AbstractIntegrationHandler
|
||||||
return [
|
return [
|
||||||
'slack_webhook_url' => 'required|url|starts_with:https://hooks.slack.com/',
|
'slack_webhook_url' => 'required|url|starts_with:https://hooks.slack.com/',
|
||||||
'include_submission_data' => 'boolean',
|
'include_submission_data' => 'boolean',
|
||||||
|
'include_hidden_fields_submission_data' => ['nullable', 'boolean'],
|
||||||
'link_open_form' => 'boolean',
|
'link_open_form' => 'boolean',
|
||||||
'link_edit_form' => 'boolean',
|
'link_edit_form' => 'boolean',
|
||||||
'views_submissions_count' => 'boolean',
|
'views_submissions_count' => 'boolean',
|
||||||
|
|
@ -34,10 +35,14 @@ class SlackIntegration extends AbstractIntegrationHandler
|
||||||
|
|
||||||
protected function getWebhookData(): array
|
protected function getWebhookData(): array
|
||||||
{
|
{
|
||||||
|
$settings = (array) $this->integrationData ?? [];
|
||||||
|
|
||||||
$formatter = (new FormSubmissionFormatter($this->form, $this->submissionData))->outputStringsOnly();
|
$formatter = (new FormSubmissionFormatter($this->form, $this->submissionData))->outputStringsOnly();
|
||||||
|
if (Arr::get($settings, 'include_hidden_fields_submission_data', false)) {
|
||||||
|
$formatter->showHiddenFields();
|
||||||
|
}
|
||||||
$formattedData = $formatter->getFieldsWithValue();
|
$formattedData = $formatter->getFieldsWithValue();
|
||||||
|
|
||||||
$settings = (array) $this->integrationData ?? [];
|
|
||||||
$externalLinks = [];
|
$externalLinks = [];
|
||||||
if (Arr::get($settings, 'link_open_form', true)) {
|
if (Arr::get($settings, 'link_open_form', true)) {
|
||||||
$externalLinks[] = '*<' . $this->form->share_url . '|🔗 Open Form>*';
|
$externalLinks[] = '*<' . $this->form->share_url . '|🔗 Open Form>*';
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,14 @@
|
||||||
label="Include submission data"
|
label="Include submission data"
|
||||||
help="With form submission answers"
|
help="With form submission answers"
|
||||||
/>
|
/>
|
||||||
|
<toggle-switch-input
|
||||||
|
v-if="compVal.include_submission_data"
|
||||||
|
v-model="compVal.include_hidden_fields_submission_data"
|
||||||
|
name="include_hidden_fields_submission_data"
|
||||||
|
class="mt-4"
|
||||||
|
label="Include hidden fields"
|
||||||
|
help="If enabled then hidden fields will be included in the notification message"
|
||||||
|
/>
|
||||||
<toggle-switch-input
|
<toggle-switch-input
|
||||||
v-model="compVal.link_open_form"
|
v-model="compVal.link_open_form"
|
||||||
name="link_open_form"
|
name="link_open_form"
|
||||||
|
|
@ -85,6 +93,7 @@ export default {
|
||||||
[
|
[
|
||||||
"message",
|
"message",
|
||||||
"include_submission_data",
|
"include_submission_data",
|
||||||
|
'include_hidden_fields_submission_data',
|
||||||
"link_open_form",
|
"link_open_form",
|
||||||
"link_edit_form",
|
"link_edit_form",
|
||||||
"views_submissions_count",
|
"views_submissions_count",
|
||||||
|
|
@ -93,6 +102,8 @@ export default {
|
||||||
if (this.compVal[keyname] === undefined) {
|
if (this.compVal[keyname] === undefined) {
|
||||||
if (keyname === 'message') {
|
if (keyname === 'message') {
|
||||||
this.compVal[keyname] = 'New form submission'
|
this.compVal[keyname] = 'New form submission'
|
||||||
|
} else if (['include_hidden_fields_submission_data'].includes(keyname)) {
|
||||||
|
this.compVal[keyname] = false
|
||||||
} else {
|
} else {
|
||||||
this.compVal[keyname] = true
|
this.compVal[keyname] = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue