• Patrick Bajao's avatar
    Handle cache busting scenario where DiffNotePosition changes · 31a57aeb
    Patrick Bajao authored
    We create/update the `DiffNotePosition` of a discussion (via the
    first note ID), whenever a MR has been updated and we check for
    mergeability of a MR. This means that when a merge request changes
    the `DiffNotePosition` can possibly change.
    
    Previously, when that happens, the cache will be stale and the
    `positions` property we return in `discussions.json` will be outdated
    and won't match anything on the new HEAD diff so discussions that
    supposed to be still displayed won't be displayed.
    
    This fix adds the SHA of `DiffNotePosition#position` records of
    each `DiffDiscussion` to the cache key. This way, if they change,
    the cache for the corresponding discussion will be invalidated.
    31a57aeb
diff_discussion.rb 1.31 KB