Skip to content

feat: add repository filter dropdown in RHS sidebar#1024

Open
rafaumeu wants to merge 3 commits into
mattermost:masterfrom
rafaumeu:feature/filter-repos-rhs-265
Open

feat: add repository filter dropdown in RHS sidebar#1024
rafaumeu wants to merge 3 commits into
mattermost:masterfrom
rafaumeu:feature/filter-repos-rhs-265

Conversation

@rafaumeu

@rafaumeu rafaumeu commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Adds a repository filter dropdown to the GitHub plugin RHS sidebar, allowing users to filter PRs, reviews, assignments, and unread notifications by specific repository.

Resolves #265

Changes

  • Added a <select> dropdown in the RHS header that lists all unique repositories from the current items
  • When a repo is selected, items are filtered to only show entries from that repository
  • Filter resets when switching between RHS tabs (PRs, Reviews, Unreads, Assignments)
  • Dropdown only appears when there are multiple repositories in the list

Release Notes

Screenshots

The dropdown appears next to the title in the RHS header, styled minimally to match the existing UI.

Change Impact: 🟡 Medium

Reasoning: The change is isolated to a single sidebar component, but it alters user-facing filtering behavior and introduces new state-driven rendering paths that need validation across the four RHS views. It doesn’t touch shared infrastructure or critical backend flows, but it does affect an important interaction in a widely used UI surface.

Regression Risk: Moderate. The main risk is incorrect filtering or reset behavior when switching tabs, especially for edge cases with empty lists, duplicate repo names, or theme-dependent styling.

QA Recommendation: Perform targeted manual QA on each RHS tab to verify repository dropdown visibility, option population, filtering, and reset behavior when changing tabs. Low risk to skip broad regression testing, but this specific sidebar flow should be checked before release.

- Add dropdown to filter PRs/reviews/assignments/unreads by repository
- Extract unique repo names from displayed items
- Reset filter when switching RHS tabs
- Only show dropdown when multiple repos are present
@rafaumeu rafaumeu requested a review from a team as a code owner June 16, 2026 22:12
@mattermost-build

Copy link
Copy Markdown
Contributor

Hello @rafaumeu,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rafaumeu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4b70d9c0-b677-4c1f-8d88-97e1b732bd54

📥 Commits

Reviewing files that changed from the base of the PR and between 7f63fdd and 83c6200.

📒 Files selected for processing (1)
  • webapp/src/components/sidebar_right/sidebar_right.jsx
📝 Walkthrough

Walkthrough

The right sidebar component now supports filtering items by repository via a dropdown. A helper extracts repository names from items, component state tracks the selected repository with reset on state change, render computes filtered items, and styling switches to a theme-aware function.

Changes

Repository Filter Feature

Layer / File(s) Summary
Repo name extraction and state
webapp/src/components/sidebar_right/sidebar_right.jsx
Adds getRepoName to derive repository names from items, initializes selectedRepo state with handleRepoFilterChange, and resets selectedRepo on rhsState changes.
Filtered rendering and dropdown UI
webapp/src/components/sidebar_right/sidebar_right.jsx
Derives a sorted unique repo list, computes filteredItems, adds a conditional repository <select> dropdown, and passes filteredItems to GithubItems.
Theme-aware styling
webapp/src/components/sidebar_right/sidebar_right.jsx
Replaces the static style object with getStyle via makeStyleFromTheme, using changeOpacity for the repo filter border.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SidebarRight
  participant GithubItems

  User->>SidebarRight: select repository from dropdown
  SidebarRight->>SidebarRight: handleRepoFilterChange updates selectedRepo
  SidebarRight->>SidebarRight: compute filteredItems from githubItems
  SidebarRight->>GithubItems: render with items=filteredItems
Loading

Poem

A rabbit hops through repos deep,
Filtering carrots the sidebar will keep. 🥕
One click, one choice, the list turns neat,
Themed borders make the view complete.
Hop, hop, hooray — filtering's a treat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: adding a repository filter dropdown in the RHS sidebar.
Linked Issues check ✅ Passed The PR implements repository filtering for the RHS list and limits dropdown options to repositories present in the current items.
Out of Scope Changes check ✅ Passed No clear out-of-scope changes are evident; styling and accessibility updates support the repository filter feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mattermost-build

Copy link
Copy Markdown
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

}

// Extract unique repo names for filter dropdown
const repoNames = [...new Set(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repo-name extraction logic is duplicated. Please factor it into a small helper at module scope so both call sites stay in sync if the GitHub response shape ever changes.

function getRepoName(item) {
    if (item.repository_url) {
        return item.repository_url.replace(/.+\/repos\//, '');
    }
    return item.repository?.full_name ?? null;
}

>{title}</a>
</strong>
{repoNames.length > 1 && (
<select

@nang2049 nang2049 Jun 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs an aria-label='Filter by repository'. Also I worry that a native will look out of place next to Mattermost's styled UI. Other plugin dropdowns use react-select. Perhaps switch to that one ? Also since sectionHeader uses default inline layout, adding the next to a long title may wrap awkwardly on narrow RHS widths.

sectionHeader: {
padding: '15px',
},
repoFilter: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded border will be invisible on dark themes and the transparent background will inherit the dark RHS color leaving the option text unreadable. This plugin already has a convention for theme-aware styles via makeStyleFromTheme, see sidebar_buttons.jsx:

import {makeStyleFromTheme, changeOpacity} from 'mattermost-redux/utils/theme_utils';
// ... bottom of file, replacing the plain `style` object:
const getStyle = makeStyleFromTheme((theme) => ({
    sectionHeader: {
        padding: '15px',
    },
    repoFilter: {
        marginLeft: '8px',
        padding: '2px 4px',
        fontSize: '12px',
        borderRadius: '4px',
        border: `1px solid ${changeOpacity(theme.centerChannelColor, 0.2)}`,
        background: 'transparent',
        color: theme.centerChannelColor,
    },
}));

@nang2049 nang2049 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rafaumeu a few comments 🎉

…on, a11y

- Extract getRepoName() helper to module scope (removes duplicated logic)
- Add aria-label='Filter by repository' to the select element
- Replace hardcoded styles with makeStyleFromTheme/changeOpacity for
  proper dark/light theme support (follows sidebar_buttons.jsx convention)

Addresses review feedback on mattermost#1024

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@webapp/src/components/sidebar_right/sidebar_right.jsx`:
- Around line 173-182: The sidebar filter is using a stale selectedRepo value
even when it no longer exists in the current repoNames list. In
sidebar_right.jsx, revalidate this.state.selectedRepo against the freshly
computed repoNames before applying the filter, and fall back to an empty
selection when it’s missing so filteredItems and the <select> stay in sync.
Update the logic around getRepoName, repoNames, and filteredItems to use the
validated repo selection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6ac8b7ca-2647-4b45-80fa-d2690bd635c2

📥 Commits

Reviewing files that changed from the base of the PR and between 5cd47fb and 7f63fdd.

📒 Files selected for processing (1)
  • webapp/src/components/sidebar_right/sidebar_right.jsx

Comment thread webapp/src/components/sidebar_right/sidebar_right.jsx
…validation

- Replace native <select> with ReactSelect for consistent theme-aware styling
- Add stale state validation: reset selectedRepo when the repo is no longer present
- Use getStyleForReactSelect(theme) for proper dark/light theme support
- Extract getCurrentItems() helper method for reuse in componentDidUpdate
- Add eslint-disable comments for setState in componentDidUpdate (required pattern)
- Update container styles (repoFilterContainer replaces repoFilter)
@rafaumeu

rafaumeu commented Jul 5, 2026

Copy link
Copy Markdown
Author

Hi @nang2049, I've addressed all review feedback in commit 83c6200:

  1. Replace native <select> with ReactSelect — uses the plugin's existing getStyleForReactSelect(theme) for full dark/light theme support, consistent with other dropdowns in the plugin.
  2. Stale state validationcomponentDidUpdate now checks if selectedRepo is still in the current item list. If the underlying data changes and the selected repo disappears, the filter resets automatically.
  3. Extracted getCurrentItems() helper — avoids code duplication between render and validation logic.

The dropdown is now searchable=false (since it's a simple filter), with menuPortalTarget=document.body to avoid clipping inside the RHS panel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support filtering of repositories in RHS

3 participants