• Patrick Bajao's avatar
    Fix stale MR discussion cache when current user role changes · becce866
    Patrick Bajao authored
    In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69642, we
    fixed the case when note's author role changes.
    
    It's also possible that the MR discussions cache will be stale if
    the current_user role has changed.
    
    For example, current user was a maintainer and viewed the MR page
    with discussions. That user will be able to resolve comments. When
    that user gets demoted to Guest, for example, they shouldn't be
    able to resolve threads anymore.
    
    Currently, that will only affect the notes they authored. For
    other notes, the "Resolve" button will still show.
    
    This fix adds the max access of the current user to the cache
    context so when it changes, the cache will be invalidated too.
    becce866
merge_requests_discussions_spec.rb 8.52 KB