Only call the resolved service if we resolve all the active notes
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79142 Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/350397 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 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. Changelog: fixed
Showing
Please register or sign in to comment