Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide invisible fields from email output according to visibility rules, fixes #1131 #1134

Merged

Conversation

xini
Copy link
Contributor

@xini xini commented Mar 7, 2022

No description provided.

@michalkleiner
Copy link
Contributor

A sentence of text for the docs/changelog would be also good since some users may rely on all fields being in the export/email regardless of their display rules, so they would need to provide a custom template after this change.

@GuySartorelli
Copy link
Member

GuySartorelli commented Mar 7, 2022

Some users may rely on all fields being in the export/email regardless of their display rules, so they would need to provide a custom template after this change.

That's a good point. It wouldn't hurt to add a configuration option (perhaps on the EmailRecipient next to HideFormData) to allow showing all fields regardless of form visibility rules (or perhaps it should show all by default as that's the current behaviour, and then this option would allow respecting form visibility rules in the email).

@GuySartorelli
Copy link
Member

Also, we should probably mention in a comment on this PR that this fixes #1131 so there is a link between this and the issue.

@xini
Copy link
Contributor Author

xini commented Mar 7, 2022

Thanks @GuySartorelli and @michalkleiner for your feedback.

I have

  • renamed the field on SubmittedFormField to Displayed
  • reversed the changes to the templates to keep the current behaviour per default
  • added a config flag HideInvisibleFields to EmailRecipient to only include visible fields in the generated email. Per default this flag is false making sure the current behaviour is maintained for existing users

These changes make sure that the current behaviour is maintained unless someone changes the settings on the recipient.

Where in the docs do you want me to mention this? There is no changelog file per se.

@GuySartorelli
Copy link
Member

That's great work! Thank you.

Where in the docs do you want me to mention this?

I'd probably recommend somewhere in https://github.com/silverstripe/silverstripe-userforms/blob/5/docs/en/userguide/form-submissions.md#email-details

@xini
Copy link
Contributor Author

xini commented Mar 7, 2022

Would it make sense to set the default of HideInvisibleFields on EmailRecipient to true, so that newly created recipients get the new behaviour?

@xini
Copy link
Contributor Author

xini commented Mar 8, 2022

I'd probably recommend somewhere in https://github.com/silverstripe/silverstripe-userforms/blob/5/docs/en/userguide/form-submissions.md#email-details

done.

@GuySartorelli
Copy link
Member

GuySartorelli commented Mar 8, 2022

Would it make sense to set the default of HideInvisibleFields on EmailRecipient to true, so that newly created recipients get the new behaviour?

I don't think so. It would be a departure from behaviour users are currently expecting and may even rely on. I can imagine cases for example where there are default values (perhaps hidden because the user filling in the form didn't tick a box that lets them edit the values) in a submission that need to be passed on to someone in the business who wasn't directly involved with setting up the form.

That said I'd defer to @michalkleiner in this case.

@xini
Copy link
Contributor Author

xini commented Mar 10, 2022

@GuySartorelli That's fine with me, no problem. Anything else to get this merged?

@GuySartorelli
Copy link
Member

That will be up to @michalkleiner or one of the other core committers - looks like the tests need fixing though.

@xini xini force-pushed the hide-invisible-fields-from-emails branch from 6a21f08 to ac4bd02 Compare March 11, 2022 03:12
@xini
Copy link
Contributor Author

xini commented Mar 11, 2022

@xini
Copy link
Contributor Author

xini commented Mar 15, 2022

The Behat tests fail here: https://github.com/silverstripe/silverstripe-userforms/blob/5/tests/behat/features/userforms.feature#L144

Any ideas why? I don't get it.

The failing test doesn't seem to be caused by my changes, https://github.com/silverstripe/silverstripe-userforms/pull/1101/checks?check_run_id=5492750488 is failing too.

Can this be merged and tagged please?

@michalkleiner
Copy link
Contributor

Yep, it seems the failure is not related to these changes.
@xini, can you please squash the commits into one with the commit message of "ENH Add config to hide invisible fields from email output". I'll merge it afterwards. Thanks!

@xini xini force-pushed the hide-invisible-fields-from-emails branch from 632bf44 to 33e9a25 Compare March 15, 2022 00:50
@xini
Copy link
Contributor Author

xini commented Mar 15, 2022

@michalkleiner done, thanks!

@michalkleiner michalkleiner merged commit 6826489 into silverstripe:5 Mar 15, 2022
@xini
Copy link
Contributor Author

xini commented Mar 15, 2022

@michalkleiner great, thanks so much!

@xini xini deleted the hide-invisible-fields-from-emails branch March 15, 2022 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants