Discussions are not assigned to force-pushed merge requests

Sometimes when you add a discussion and force-push to the branch the discussion won't be rendered on the frontend.

Example MR. Notice that some of the discussions are not rendered on the Changes tab while they are present on the Overview tab.

This happens because of two things at play:

  1. Backend sends different positions for a discussion: position, original_position and positions.
  2. Frontend expects one of these positions to match a selected diffPosition except for line ranges image

The problem arises when none of the discussion positions match available positions on the line:

image

We need to either adjust the frontend logic or make sure the backend sends correct positions.

The bug was easier to identify because of the refactorings in Unify collapse\expand all unresolved threads ac... (!136034 - merged).

Edited by Stanislav Lashmanov