Skip to content

Notify current_user about automatic merge after successful build

What does this MR do?

It enables notifications to the initiator of a merge when the MR is flagged as "Merge when build succeeds".

Are there points in the code the reviewer needs to double check?

The build_recipients method currently assumes that the current_user is not to be included so it always removes it from the list of recipients. This assumption is not part of the method's responsibility which tries to be agnostic to the nature of the target. I pushed the logic of whether to skip the current_user from the recipients list, upwards to the caller. An other option would be to directly ask the target if the current_user is to be included or not but this might introduce some cryptic methods to the target's model so I chose the current solution. Still the two changed methods' signatures are now a little complicated. Maybe we could add an options hash as the last argument instead.

Why was this MR needed?

Because when running Builds, quite some time passes between the user's action and the actual Merge so it is a good thing to notify the initiator of the Merge when it actually happens.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/14409

Merge request reports