Skip to content

Enforce unique contact email for group hierarchy

Lee Tickett requested to merge 349686-enforce-unique-contact-email into master

What does this MR do and why?

Related to #349686 (closed)

At the moment, the primary technique for adding/removing contacts from issues is via quick actions.

The quick actions use e-mail address as the parameter/key. So if we have multiple contacts with the same e-mail address, the system will randomly select which to associate.

This MR prevents creation of new contacts within a group hierarchy if a contact already exists with the same e-mail.

It is likely we will remove this validation at a later stage when we improve the quick action to use auto-complete etc

Screenshots or screen recordings

dupe_email_enforce

How to set up and validate locally

0. Enable :customer_relations feature flag for a group via the rails console
1. Visit a group settings page (e.g. http://gdk.test:3000/groups/flightjs/-/edit
2. Expand "Permissions and group features"
3. At the very bottom, select "Enable customer relations"
4. Select "Save changes"
5. Visit the customer relations > contacts page for the group (e.g. http://gdk.test:3000/groups/flightjs/-/crm/contacts
8. Create a new contact
9. Visit a child group settings page (e.g. http://gdk.test:3000/groups/flightjs/-/edit
10. Expand "Permissions and group features"
11. At the very bottom, select "Enable customer relations"
12. Select "Save changes"
13. Visit the customer relations > contacts page for the subgroup (e.g. http://gdk.test:3000/groups/flightjs/-/crm/contacts
14. Try and create a contact using the same e-mail address as step 8 (you should get an error)

Bonus points for testing using GraphQL :)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Lee Tickett

Merge request reports