Skip to content

dev.git: drop MRs you already approved from the GitLab review queue - #2

Open
stepiiik wants to merge 1 commit into
ariadev:mainfrom
stepiiik:gitlab-hide-approved-reviews
Open

stepiiik wants to merge 1 commit into
ariadev:mainfrom
stepiiik:gitlab-hide-approved-reviews

Conversation

@stepiiik

Copy link
Copy Markdown

Problem

GitLab keeps you on an MR's reviewer list after you approve it. That means the GitLab Awaiting review queue, its count and the bar dot all keep counting every MR you've already approved that isn't merged yet. On GitHub, review-requested:@me stops matching once you submit a review, so only GitLab behaves this way.

Change

  • bin/gitwork: reviewRequestedMergeRequests now filters on your own review state. It keeps every state except APPROVED (UNREVIEWED, REVIEWED, REVIEW_STARTED, REQUESTED_CHANGES, UNAPPROVED).
    • An MR approved by other reviewers but not by you still shows up.
    • If a new push resets approvals, the MR comes back as UNAPPROVED.
    • The tile count and the bar dot come from the same field's count, so they update without any other changes.
  • Panel.qml: the Awaiting review tile now opens the dashboard with the matching not[approved_by_usernames][] filter, so the page lists the same MRs as the panel.

Testing

  • ./tests/run.sh: all suites pass. shellcheck wasn't run locally; the shell change is only inside the GraphQL heredoc.
  • Checked against gitlab.com with a real account: the review queue went from 8 to 1. The reviewStates filter and not: {approvedBy: [viewer]} return the same result.

Compatibility note

I've only tested this on gitlab.com. Older self-managed GitLab versions may not support the reviewStates argument, which would fail the whole query for that host. They may also lack the /dashboard/merge_requests/search page. If you want to support older instances, this could be put behind a version check or an opt-in setting.

🤖 Generated with Claude Code

GitLab keeps you on an MR's reviewer list after you approve, so the
awaiting-review queue, its count and the bar dot kept every approved but
unmerged MR. GitHub's review-requested:@me stops matching once you submit
a review, so the GitLab tab was the odd one out.

The query now filters on the viewer's own review state and keeps every
state except APPROVED. A merge request approved by others but not by you
still shows, and one whose approvals were reset by a new push comes back
as UNAPPROVED. The count comes from the same field, so the tile and the
dot follow without further changes.

The tile's link gets the matching not[approved_by_usernames][] filter, so
the dashboard it opens lists the same merge requests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant