Skip to content

Comments

feat: implement community page#3873

Closed
HarshitVerma109 wants to merge 5 commits intoOWASP:mainfrom
HarshitVerma109:feat/community-page
Closed

feat: implement community page#3873
HarshitVerma109 wants to merge 5 commits intoOWASP:mainfrom
HarshitVerma109:feat/community-page

Conversation

@HarshitVerma109
Copy link
Contributor

Proposed change

Resolves #3862

I implemented the new Community Hub page at /community, which serves as a central place to discover recent chapters, organizations, top contributors, and key community stats.

Screen.Recording.2026-02-09.190054.1.mp4

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran make check-test locally: all warnings addressed, tests passed
  • I used AI for code, documentation, tests, or communication related to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Summary by CodeRabbit

  • New Features

    • Dedicated Community hub page with search, navigation cards, new chapters, new organizations, snapshots, top contributors, and stats panel.
    • Recent organizations API surfaced for the Community view.
    • New ChapterCard component for consistent chapter displays.
  • Improvements

    • Breadcrumbs now include a Community segment for related pages.
    • Page metadata and layout support added for Community.
  • Tests

    • Added unit, accessibility, and end-to-end tests and fixtures covering Community UI and recent organizations.

Walkthrough

Adds a Community feature: backend GraphQL field to fetch recent OWASP-related organizations; new frontend Community page, layout, metadata, GraphQL query, components, and tests; breadcrumb hook updated to insert a "Community" segment for related routes.

Changes

Cohort / File(s) Summary
Backend - Organization Query
backend/apps/github/api/internal/queries/organization.py
Added MAX_LIMIT, imported strawberry_django and normalize_limit, and added recent_organizations(self, limit: int = 5) GraphQL field that normalizes limit and returns recent OWASP-related organizations ordered by -created_at.
Backend - Tests
backend/tests/apps/github/api/internal/queries/organization_test.py
Added three tests for recent_organizations covering positive, zero, and negative limits; patches Organization.objects.filter and asserts ordering, slicing, and early-return behavior.
Frontend - Community page & layout
frontend/src/app/community/page.tsx, frontend/src/app/community/layout.tsx
New client-side Community page (Apollo query, loading/error handling, UI sections) and layout exporting metadata and rendering children.
Frontend - GraphQL & mock data
frontend/src/server/queries/communityQueries.ts, frontend/__tests__/mockData/mockCommunityData.ts, frontend/__tests__/e2e/data/mockCommunityData.ts
Added GET_COMMUNITY_PAGE_DATA GraphQL document and unit/e2e mock fixtures for community data.
Frontend - Breadcrumbs & metadata config
frontend/src/hooks/useBreadcrumbs.ts, frontend/src/utils/metadata.ts
Added COMMUNITY_RELATED_PATHS and logic to inject a /community breadcrumb for related routes; added community entry to METADATA_CONFIG.
Frontend - Tests (unit, e2e, a11y)
frontend/__tests__/unit/pages/Community.test.tsx, frontend/__tests__/unit/hooks/useBreadcrumbs.test.tsx, frontend/__tests__/e2e/pages/Community.spec.ts, frontend/__tests__/e2e/pages/Chapters.spec.ts, frontend/__tests__/e2e/pages/Organizations.spec.ts, frontend/__tests__/e2e/pages/Users.spec.ts, frontend/__tests__/a11y/pages/Community.a11y.test.tsx
Added unit tests for Community page and breadcrumbs, new e2e suite for Community, updated breadcrumb expectations in several e2e tests, and added an a11y test for Community.
Frontend - Components & Home page update
frontend/src/components/ChapterCard.tsx, frontend/src/app/page.tsx
Added ChapterCard component and refactored home page to render recent chapters via ChapterCard instead of inline markup.
Frontend - E2E fixtures & breadcrumb expectations
frontend/__tests__/e2e/pages/..., frontend/__tests__/e2e/data/*
Updated e2e breadcrumb expectations to include the Community segment for related pages and added e2e fixtures used by Community tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • arkid15r
  • kasya
🚥 Pre-merge checks | ✅ 4 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (16 files):

⚔️ backend/apps/github/api/internal/queries/organization.py (content)
⚔️ backend/poetry.lock (content)
⚔️ backend/tests/apps/github/api/internal/queries/organization_test.py (content)
⚔️ docker/backend/Dockerfile (content)
⚔️ docs/poetry.lock (content)
⚔️ frontend/__tests__/e2e/pages/Chapters.spec.ts (content)
⚔️ frontend/__tests__/e2e/pages/Organizations.spec.ts (content)
⚔️ frontend/__tests__/e2e/pages/Users.spec.ts (content)
⚔️ frontend/__tests__/unit/hooks/useBreadcrumbs.test.tsx (content)
⚔️ frontend/package.json (content)
⚔️ frontend/pnpm-lock.yaml (content)
⚔️ frontend/src/app/page.tsx (content)
⚔️ frontend/src/hooks/useBreadcrumbs.ts (content)
⚔️ frontend/src/types/__generated__/graphql.ts (content)
⚔️ frontend/src/utils/metadata.ts (content)
⚔️ trivy.yaml (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: implement community page' directly and clearly summarizes the main change—implementing a new Community page feature at /community.
Description check ✅ Passed The description is directly related to the changeset, explaining the Community Hub page implementation, referencing the resolved issue #3862, and listing completed checklist items.
Linked Issues check ✅ Passed The PR fully addresses issue #3862 requirements: implements Community page, displays stats (Active Chapters, Active Projects, Contributors, Countries), shows recent chapters/organizations, and provides community context and navigation.
Out of Scope Changes check ✅ Passed All changes align with the linked issue: Community page implementation, stats display, breadcrumb updates, and ChapterCard component refactoring are all within scope of creating an informative Community Hub.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch feat/community-page
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
backend/tests/apps/github/api/internal/queries/organization_test.py (1)

68-82: Consider adding a test for the MAX_LIMIT cap.

The zero and negative limit tests cover the normalize_limit → None path well. A test with limit=200 (exceeding MAX_LIMIT=100) would verify the capping behavior — the slice should be slice(None, 100). This would also guard against accidental changes to MAX_LIMIT.


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 and usage tips.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 18 files

Confidence score: 4/5

  • This PR looks generally safe to merge with a small, contained risk from one medium‑severity issue.
  • frontend/src/app/community/page.tsx stringifies chapter.leaders, which can lose structure and may change how LeadersList renders leader data.
  • Pay close attention to frontend/src/app/community/page.tsx - ensure LeadersList receives the leaders array directly to avoid lossy conversion.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="frontend/src/app/community/page.tsx">

<violation number="1" location="frontend/src/app/community/page.tsx:168">
P2: `String(chapter.leaders)` converts an `Array<string>` to a comma-separated string. This is a lossy conversion — pass the array directly to the `LeadersList` component instead of stringifying it.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@backend/tests/apps/github/api/internal/queries/organization_test.py`:
- Around line 52-63: The test for OrganizationQuery.recent_organizations is not
verifying that the queryset is sliced; change mock_qs.order_by to return another
Mock instead of a list (e.g., next_qs = Mock(); mock_qs.order_by.return_value =
next_qs) and assert that next_qs.__getitem__ was called with slice(None, 2) to
ensure the [:limit] operation occurs; additionally add a separate test calling
OrganizationQuery().recent_organizations with limit=0 (or an invalid limit) and
assert it returns [] to cover the normalize_limit → None branch.

In `@frontend/src/app/community/page.tsx`:
- Around line 194-202: The org avatar URL is built incorrectly by always
appending "&s=80" to org.avatarUrl; update the Image src construction (the JSX
using org.avatarUrl inside page.tsx) to conditionally append a size param like
the contributor avatar does—i.e., if org.avatarUrl includes a "?" use "&s=80",
otherwise use "?s=80"—so the src becomes a properly formed URL when rendering
the Image component for org avatars.
- Around line 59-61: The current render early-return uses "if (isLoading ||
!graphQLData) return <LoadingSpinner />", which causes a permanent spinner when
the GraphQL query errored; update the conditional in page.tsx to explicitly
check graphQLRequestError (the error variable returned by your GraphQL hook)
before falling back to LoadingSpinner, and render an error/empty state (or a
friendly message/component) when graphQLRequestError is present instead of
treating it as a loading state; ensure references to isLoading, graphQLData, and
graphQLRequestError are used so the UI shows a spinner only while loading and an
error/empty view when the request fails.
🧹 Nitpick comments (5)
frontend/__tests__/unit/hooks/useBreadcrumbs.test.tsx (1)

80-86: Consider adding a test for the /community path itself.

To ensure no duplicate "Community" breadcrumb appears when navigating directly to /community, a test asserting [{ title: 'Home', path: '/' }, { title: 'Community', path: '/community' }] would be a useful edge-case addition.

frontend/src/app/community/page.tsx (1)

63-63: Redundant alias.

const data = graphQLData adds no value since graphQLData is already descriptively named. Consider using graphQLData directly or destructuring the query result as data from the start.

frontend/__tests__/unit/pages/Community.test.tsx (1)

53-70: Error test doesn't assert the rendered UI state.

The test verifies the toast is triggered but doesn't assert what the user actually sees. Given the permanent-spinner bug noted in the page component, this test would pass even with that broken UX. Consider adding an assertion for the rendered output after error (e.g., verifying no loading spinner or showing an error message).

frontend/__tests__/e2e/pages/Community.spec.ts (1)

40-45: Fragile CSS class selector for navigation cards.

page.locator('.grid.grid-cols-2') is tied to Tailwind utility classes and will break if styling changes. Consider using a data-testid attribute or a more semantic locator.

frontend/__tests__/e2e/data/mockCommunityData.ts (1)

59-69: topContributors entries are missing the id field.

The GraphQL query requests id for topContributors, and the unit test mock (mockCommunityGraphQLData) includes it, but this e2e fixture omits it. While this doesn't affect rendering (the page uses login as the key), it's an inconsistency with the actual query response shape.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@frontend/src/app/community/page.tsx`:
- Around line 248-266: The contributors list always renders the Image even when
contributor.avatarUrl is null, causing broken src like "null?s=60"; update the
contributors rendering to guard avatar rendering the same way as orgs: only
render the <Image> when contributor.avatarUrl is truthy, e.g., wrap the Image in
a conditional check on contributor.avatarUrl (or use {contributor.avatarUrl &&
(...)}) and keep getMemberUrl, Link and the text rendering unchanged; also
normalize optional chaining by removing unnecessary contributor?. usages inside
the .map callback where contributor is guaranteed to be defined (e.g., use
contributor.name, contributor.login, contributor.avatarUrl consistently).
🧹 Nitpick comments (2)
backend/tests/apps/github/api/internal/queries/organization_test.py (1)

68-82: Good edge-case coverage for invalid limits.

Both tests correctly verify the early-return [] path and confirm no database query is issued.

Consider also adding a test with limit > MAX_LIMIT (e.g., limit=200) to verify the clamping behavior of normalize_limit, ensuring the slice uses MAX_LIMIT (100) rather than the raw input.

frontend/src/app/community/page.tsx (1)

73-73: Redundant alias: const data = graphQLData.

data is just a reassignment of graphQLData with no transformation. You could either rename the destructured variable directly in the useQuery call or use graphQLData throughout.

♻️ Suggested simplification
   const {
-    data: graphQLData,
+    data,
     error: graphQLRequestError,
     loading: isLoading,
   } = useQuery(GetCommunityPageDataDocument)
   ...
-  if (graphQLRequestError || !graphQLData) {
+  if (graphQLRequestError || !data) {
     ...
   }
-
-  const data = graphQLData

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@frontend/src/app/community/page.tsx`:
- Around line 75-92: The code constructs statsData by accessing
data.statsOverview fields directly and also calls millify later, which will
throw if statsOverview is null/undefined; update the code to null-safe these
accesses by using optional chaining and sensible defaults (e.g.,
data.statsOverview?.activeChaptersStats ?? 0 or a placeholder) when building
statsData and before calling millify, or skip/render a fallback when the value
is missing; refer to the statsData array and any millify(...) call to add these
guards so runtime TypeErrors are prevented.
🧹 Nitpick comments (2)
frontend/src/app/community/page.tsx (2)

73-73: Redundant alias const data = graphQLData.

This intermediate variable adds no value since graphQLData is already descriptively named and narrowed to non-null by the guard above. Consider using graphQLData directly or destructuring the needed fields.


95-95: Hardcoded dark-mode background color.

dark:bg-[#212529] is a magic value. If this color is part of the design system, consider defining it as a theme token to keep dark-mode colors consistent and maintainable across pages.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 9, 2026
@HarshitVerma109
Copy link
Contributor Author

@cubic-dev-ai review this pull request

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Feb 9, 2026

@cubic-dev-ai review this pull request

@HarshitVerma109 I have started the AI code review. It will take a few minutes to complete.

cubic-dev-ai[bot]
cubic-dev-ai bot previously approved these changes Feb 9, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 20 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@HarshitVerma109
Copy link
Contributor Author

HarshitVerma109 commented Feb 10, 2026

@arkid15r @kasya , please review it and let me know if any changes are required.

@sonarqubecloud
Copy link

@HarshitVerma109
Copy link
Contributor Author

@arkid15r, I’ve resolved the merge conflicts. Please review the changes and let me know if any further adjustments are needed.

@arkid15r
Copy link
Collaborator

Closing in favor of #3912

@arkid15r arkid15r closed this Feb 15, 2026
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.

Add Community Overview Stats Section

2 participants