Skip to content

feat: community projects "My contributions only" toggle and switcher entry#3820

Merged
Anty0 merged 4 commits into
jirikuchynka/community-contributorsfrom
jirikuchynka/community-projects-page
Jul 24, 2026
Merged

feat: community projects "My contributions only" toggle and switcher entry#3820
Anty0 merged 4 commits into
jirikuchynka/community-contributorsfrom
jirikuchynka/community-projects-page

Conversation

@Anty0

@Anty0 Anty0 commented Jul 23, 2026

Copy link
Copy Markdown
Member

Part 3 of the Community Contributors pitch (#3806) — the /community-projects page. Merges into the integration branch jirikuchynka/community-contributors (#3819), not main.

What this adds

  • "My contributions only" toggle on /community-projects, default on. On, it lists public projects the user contributed to but is not a member of; off lists every public project. It sits where the add button renders on the normal projects list (the header's right slot, next to the search field).
  • Re-wired "Community translation" org-switcher entry. It appears exactly for users with at least one contribution in a currently-public project they are not a member of — i.e. exactly when the community page has something to show them.
  • Re-enabled the five skipped switcher-navigation e2e tests.

How it works

  • The toggle drives a new opt-in filterContributed param on GET /v2/public/projects/with-stats. The predicate reuses Scope A's project_contributor table (EXISTS a contribution) plus a member-exclusion that mirrors the per-project contributor list, so the page and the switcher agree. The param is opt-in per caller, so the public homepage listing (which shares the hook) is unchanged.
  • The switcher entry is gated on a new InitialDataModel.hasCommunityContributions boolean — a cheap EXISTS over the project_contributor user_id index, computed per authenticated user and piggybacked on the already-cached initial-data payload the switcher reads (no extra request, available on every page).

Tests

  • Backend: filterContributed listing (non-member contributor only; member-owned excluded; anonymous empty) and the hasCommunityContributions boolean, in PublicProjectsControllerTest; InitialDataControllerTest asserts the field is wired.
  • E2E: the 5 switcher-nav tests re-enabled (seed a contribution for the admin login user via a small dedicated e2e-data set); existing list/threshold tests flip the toggle off (they assert the all-public view); new tests cover the default-on mine-only behavior.

Known limitation (accepted, per pitch scope)

A contributor with no organization of their own won't see the switcher entry — the org popover renders nothing without a preferred organization.

Translations

The community_my_contributions_toggle key ("My contributions only") is created in the Tolgee project (id 1), tagged draft: community-projects-page. No screenshot uploaded yet.

…entry

Add the "My contributions only" toggle to /community-projects (default on,
listing public projects the user contributed to as a non-member; off lists all
public projects), served by a new opt-in filterContributed param on
GET /v2/public/projects/with-stats reusing the project_contributor table.

Re-wire the "Community translation" org-switcher entry, gated on a new
InitialDataModel.hasCommunityContributions flag (a cheap EXISTS over the
project_contributor user_id index), so the entry appears exactly when the
community page has something to show. Re-enable the five skipped switcher
navigation e2e tests and adapt the list/threshold tests to the default-on
toggle; seed the required contributions in e2e test data.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cee4dfe9-fa49-4925-9cd3-07783c8fdc2b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jirikuchynka/community-projects-page

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

Anty0 added 3 commits July 23, 2026 22:39
…ments

Rewrite hasNonMemberPublicContribution to structurally mirror
ProjectRepository.findAllPublic so the switcher gate and the community-page
listing read the same rule and cannot silently diverge (behavior-preserving).
Remove design-rationale/test-setup comments per the project comments rule.
Rename the stashed e2e-data field to currentTestData to drop the parameter
shadowing (matches QaE2eDataController). Add a test covering the
direct-permission half of the membership exclusion, and clean
communityContributionData in the list/threshold/toggle e2e suites so they are
isolated from the navigation suite's seeding regardless of run order.
… constant

Replace the two parallel copies of the "non-member public contributor" filter
with a single ProjectRepository.NON_MEMBER_CONTRIBUTOR_FILTER constant, used by
both findAllPublic (mine-only branch) and hasNonMemberPublicContribution, so the
switcher gate and the community-page listing cannot diverge by construction —
the codebase's existing pattern (BASE_VIEW_QUERY, PUBLIC_PROJECT_VISIBILITY).
Unify the bind parameter name and drop the coupling comment.
Add an e2e test asserting the "Community translation" switcher entry is absent
for a signed-in user with no community contributions — the gate's false branch
was untested, so a regression to always-on would have passed the suite.

Also: document NON_MEMBER_CONTRIBUTOR_FILTER's required aliases/param, rename
the injected UserAccountService to the conventional name, and switch the
captured e2e-data field to the nullable-with-guard convention used by the
sibling e2e controllers.
@Anty0
Anty0 merged commit 4caf8fd into jirikuchynka/community-contributors Jul 24, 2026
103 of 110 checks passed
@Anty0
Anty0 deleted the jirikuchynka/community-projects-page branch July 24, 2026 09:33
Anty0 added a commit that referenced this pull request Jul 25, 2026
…entry (#3820)

Add the "My contributions only" toggle to /community-projects (default on; lists public projects the user contributed to as a non-member, off lists all public projects) via an opt-in filterContributed param on GET /v2/public/projects/with-stats. Re-wire the "Community translation" org-switcher entry, gated on a new InitialDataModel.hasCommunityContributions flag; the gate and the list filter share one NON_MEMBER_CONTRIBUTOR_FILTER constant. Re-enable the five skipped switcher-navigation e2e tests and add default-on/negative-branch coverage.
Anty0 added a commit that referenced this pull request Jul 25, 2026
…entry (#3820)

Add the "My contributions only" toggle to /community-projects (default on; lists public projects the user contributed to as a non-member, off lists all public projects) via an opt-in filterContributed param on GET /v2/public/projects/with-stats. Re-wire the "Community translation" org-switcher entry, gated on a new InitialDataModel.hasCommunityContributions flag; the gate and the list filter share one NON_MEMBER_CONTRIBUTOR_FILTER constant. Re-enable the five skipped switcher-navigation e2e tests and add default-on/negative-branch coverage.
Anty0 added a commit that referenced this pull request Jul 26, 2026
…entry (#3820)

Add the "My contributions only" toggle to /community-projects (default on; lists public projects the user contributed to as a non-member, off lists all public projects) via an opt-in filterContributed param on GET /v2/public/projects/with-stats. Re-wire the "Community translation" org-switcher entry, gated on a new InitialDataModel.hasCommunityContributions flag; the gate and the list filter share one NON_MEMBER_CONTRIBUTOR_FILTER constant. Re-enable the five skipped switcher-navigation e2e tests and add default-on/negative-branch coverage.
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