Skip to content

Only call the resolved notification service if we have resolved all the notes

Marc Shaw requested to merge reload_diff_in_update_service_part_2 into master

What does this MR do and why?

Related to: #350397 (closed)

We are looping over the 'active' discussions, active is when the discussion is on an 'active' diff (not outdated), regardless of it is resolved or not. We then were calling the ResolvedNotificationService, which only checks if the discussions are resolved. But these two are mututaly exclusive, one can be active and resolved.

So in the case that we have only one active resolved discussion which doesn't get outdated, the ResolvedNotificationService will be called each time this method is called, and this service will handle it as if we have just resolved all the discussions, when in fact we may not have resolved any discussions when calling the UpdateDiffPositionService.

So we now keep track of if all the active discussions are resolved before calling the UpdateDiffPositionService, and then compare this to after the update service is called, and depending on this, we may or may not call the ResolvedNotification service.

If we go from:

Before Update Service call After Update service call Call Resolved Notification service
False True True
False False False
True True False

We only want to call the ResolvedNotificationService if we have go from having unresolved active, to all the active being resolved, otherwise there is no need to call it as the check in ResolvedNotification will be false. And when all the active discussions are already resolved, the notification service will already have been called, so no need to call it again.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

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 Marc Shaw

Merge request reports