Deliver email when user contributions are assigned
What does this MR do and why?
This change delivers the email added in !157729 (merged) when import user contributions are assigned, or if the assignee should receive the email again.
The mutations that trigger this email are behind the
bulk_import_user_mapping
feature flag.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
On the Rails console, create a new Import::SourceUser
:
source_user = FactoryBot.create(:import_source_user, namespace: Group.first.root_ancestor)
And then do the following to get a <SOURCE_USER_ID>
to use in the mutations:
source_user.to_global_id.to_s
Use GraphiQL http://gdk.test:3000/-/graphql-explorer to send mutation requests:
mutation {
importSourceUserReassign(input: { id: "<SOURCE_USER_ID>", assigneeUserId: "gid://gitlab/User/1" }) {
importSourceUser {
status
}
}
}
Open http://gdk.test:3000/rails/letter_opener and see the email.
Now re-send the same email again:
mutation {
importSourceUserResendNotification(input: { id: "<SOURCE_USER_ID>" }) {
errors
importSourceUser {
status
}
}
}
And again check the email was received.
Select Review assignment details button in the email, and then either accept or reject the contribution reassignment. Try both mutations again and you should not receive any further emails using those arguments.
Related to #455912 (closed)