Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/NestPublic

Added repository count and followers count for the users/organizations page#1370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
arkid15r merged 3 commits intoOWASP:mainfromabhayymishraa:feat/improvements
Apr 14, 2025

Conversation

abhayymishraa
Copy link
Collaborator

@abhayymishraaabhayymishraa commentedApr 14, 2025
edited
Loading

image
image

Add the PR description here.

  • Added repository count in the Organization through algolia
  • Added repository count and followers count for users page and organizations page
  • Added e2e testcases to test

@coderabbitaicoderabbitai
Copy link
Contributor

coderabbitaibot commentedApr 14, 2025
edited
Loading

Summary by CodeRabbit

  • New Features
    • User and organization profiles now display public repository counts along with follower metrics.
    • Enhanced number formatting and refined layout improve readability, giving a more comprehensive overview of key activity statistics.

Walkthrough

The changes introduce a new attribute for public repository counts in both backend and frontend code. On the backend, indexing functions are updated to include an additional attribute (idx_public_repositories_count) for organizations. On the frontend, theUserCard component and related page components now pass and render arepositories_count property (sourced from public repository counts) with updated prop ordering and display logic. Corresponding type definitions have also been updated to incorporate these new repository count properties.

Changes

File(s)Change Summary
backend/apps/core/utils/index.py
backend/apps/github/index/organization.py
backend/apps/github/models/mixins/organization.py
Added theidx_public_repositories_count attribute/property to include public repositories count when indexing organizations.
frontend/src/app/members/page.tsx
frontend/src/app/organizations/page.tsx
Updated the props passed to theUserCard component by adding/reordering therepositories_count (mapped from public repository count) alongside existing properties.
frontend/src/components/UserCard.tsxReordered destructured props and added logic to conditionally renderrepositories_count using themillify function and a new FontAwesome icon.
frontend/src/types/card.ts
frontend/src/types/organization.ts
Updated interfaces by adding repository count properties (repositories_count? inUserCardProps andpublic_repositories_count inOrganizationTypeAlgolia).
frontend/__tests__/e2e/pages/Organizations.spec.tsAdded a new test case to validate the display of followers and repositories counts on the Organization Page.
frontend/__tests__/e2e/pages/Users.spec.tsSimplified button name checks and added a new test case for verifying followers and repositories counts for users.
frontend/__tests__/unit/data/mockOrganizationData.tsIntroduced a new propertypublic_repositories_count for organization mock data.
frontend/__tests__/unit/data/mockUserData.tsAddedfollowers_count andpublic_repositories_count properties to user mock data.

Suggested labels

backend-tests

Suggested reviewers

  • kasya
  • arkid15r

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat withCodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag@coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag@coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings togenerate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add@coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add@coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add@coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit ourDocumentation for detailed information on how to use CodeRabbit.
  • Join ourDiscord Community to get help, request features, and share feedback.
  • Follow us onX/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitaicoderabbitaibot 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: 0

🧹 Nitpick comments (1)
frontend/src/types/card.ts (1)

54-64:Naming consistency between interfaces.

I noticed that we're usingpublic_repositories_count inOrganizationTypeAlgolia butrepositories_count inUserCardProps. While this works, consider using consistent naming across the codebase to avoid confusion.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between09de2e9 andda4884d.

📒 Files selected for processing (8)
  • backend/apps/core/utils/index.py (1 hunks)
  • backend/apps/github/index/organization.py (1 hunks)
  • backend/apps/github/models/mixins/organization.py (1 hunks)
  • frontend/src/app/members/page.tsx (1 hunks)
  • frontend/src/app/organizations/page.tsx (1 hunks)
  • frontend/src/components/UserCard.tsx (2 hunks)
  • frontend/src/types/card.ts (1 hunks)
  • frontend/src/types/organization.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
frontend/src/app/members/page.tsx (1)
frontend/src/types/user.ts (1)
  • user (3-17)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: Run frontend unit tests
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
🔇 Additional comments (10)
frontend/src/types/organization.ts (1)

14-14:LGTM: Added repository count property successfully.

The addition ofpublic_repositories_count as a required number property to theOrganizationTypeAlgolia interface properly enables tracking and displaying the count of public repositories for organizations.

frontend/src/types/card.ts (1)

63-63:LGTM: Added repository count to UserCardProps.

The addition of the optionalrepositories_count property to theUserCardProps interface aligns with the PR objectives, allowing displaying repository counts for users while maintaining consistency with other existing optional properties likefollowers_count.

backend/apps/github/index/organization.py (1)

22-22:LGTM: Added repository count field to Algolia index.

The addition of"idx_public_repositories_count" to the fields tuple properly exposes this data for indexing in Algolia, which is correctly positioned in alphabetical order among the other fields.

backend/apps/github/models/mixins/organization.py (1)

69-73:LGTM: Added property method for repository count.

The newidx_public_repositories_count property method follows the established pattern of other index mixin properties, is well-documented, and correctly returns the organization's public repositories count for indexing purposes.

backend/apps/core/utils/index.py (1)

119-130:LGTM: Added repository count attribute for organizations

You've correctly added theidx_public_repositories_count attribute to the list of retrievable attributes for organizations, which will ensure this data is available for the frontend.

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

43-46:Well-implemented followers and repositories count

Good addition of the followers and repositories count properties to the UserCard component. The implementation correctly uses the existing properties from the user object.

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

40-48:Props reordering with repositories count added

The reordering of properties improves readability, and the addition of the repositories count fromorganization.public_repositories_count aligns with the backend changes.

frontend/src/components/UserCard.tsx (3)

1-7:Good imports for new functionality

You've added the required imports for the new feature:faFileCode for the repository icon andmillify for nicely formatting large numbers.


8-18:Well-structured props destructuring

The props are now properly reorganized and include the newrepositories_count property. The order makes logical sense, grouping related properties together.


45-58:Nice UI implementation for displaying counts

Great implementation of the counts display:

  1. The flex container with gap creates a clean layout
  2. Conditional rendering ensures counts are only shown when they exist
  3. Usingmillify with precision parameter makes the numbers more readable
  4. Appropriate icons add visual context for each metric

@sonarqubecloudSonarQubeCloud
Copy link

Please retry analysis of this Pull-Request directly on SonarQube Cloud

Copy link
Contributor

@coderabbitaicoderabbitaibot 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: 0

🧹 Nitpick comments (2)
frontend/__tests__/e2e/pages/Organizations.spec.ts (1)

39-42:Make the test more specific by associating counts with their metrics.

The test verifies that formatted counts are visible but doesn't distinguish between followers and repositories counts. Consider using more specific selectors or data-testid attributes to ensure you're testing the right metrics in the right places.

- test('displays followers and repositories counts correctly', async ({ page }) => {-   await expect(page.getByText('1k')).toBeVisible()-   await expect(page.getByText('1.5k')).toBeVisible()+ test('displays followers and repositories counts correctly', async ({ page }) => {+   // Check first organization (test-org) with 1k followers and 2k repositories+   await expect(page.locator('[data-testid="followers-count"]').first()).toContainText('1k')+   await expect(page.locator('[data-testid="repositories-count"]').first()).toContainText('2k')++   // Check second organization (another-org) with 2k followers and 1.5k repositories+   await expect(page.locator('[data-testid="followers-count"]').nth(1)).toContainText('2k')+   await expect(page.locator('[data-testid="repositories-count"]').nth(1)).toContainText('1.5k')  })
frontend/__tests__/e2e/pages/Users.spec.ts (1)

56-61:Enhance test specificity for metric values.

Similar to the Organizations test, this test could be more specific about which metric each value represents. Consider using more precise selectors or data-testid attributes to avoid potential ambiguity.

  test('displays followers and repositories counts correctly', async ({ page }) => {    const userButton = await page.getByRole('button', { name: 'John Doe' })    await userButton.waitFor({ state: 'visible' })-   await expect(page.getByText('1k')).toBeVisible()-   await expect(page.getByText('2k')).toBeVisible()+   await expect(page.locator('[data-testid="followers-count"]').first()).toContainText('1k')+   await expect(page.locator('[data-testid="repositories-count"]').first()).toContainText('2k')  })
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and betweenda4884d andac6d14e.

📒 Files selected for processing (4)
  • frontend/__tests__/e2e/pages/Organizations.spec.ts (1 hunks)
  • frontend/__tests__/e2e/pages/Users.spec.ts (2 hunks)
  • frontend/__tests__/unit/data/mockOrganizationData.ts (2 hunks)
  • frontend/__tests__/unit/data/mockUserData.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: Run frontend unit tests
🔇 Additional comments (4)
frontend/__tests__/unit/data/mockUserData.ts (1)

9-10:LGTM! The mock data updates properly support the new feature.

The addition of follower and repository counts to the mock user data correctly implements the structure needed for testing the new UI features.

Also applies to: 18-19

frontend/__tests__/unit/data/mockOrganizationData.ts (1)

15-15:LGTM! The mock organization data now includes public repository counts.

The addition of thepublic_repositories_count property to the organization objects properly supports the new feature for displaying repository counts.

Also applies to: 31-31

frontend/__tests__/e2e/pages/Users.spec.ts (2)

27-28:Button name simplification improves test clarity.

The simplified button names make the tests more maintainable and less brittle. This is a good improvement.

Also applies to: 50-50


43-43:Good use ofexact: true for precise button selection.

Adding theexact: true option for the page number button prevents potential false matches with other elements containing the text "2".

@abhayymishraaabhayymishraa marked this pull request as ready for reviewApril 14, 2025 14:55
Copy link
Collaborator

@arkid15rarkid15r left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@arkid15rarkid15r added this pull request to themerge queueApr 14, 2025
Merged via the queue intoOWASP:main with commit1de84f0Apr 14, 2025
21 of 22 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

@arkid15rarkid15rarkid15r approved these changes

@kasyakasyaAwaiting requested review from kasyakasya is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@abhayymishraa@arkid15r

[8]ページ先頭

©2009-2025 Movatter.jp