Skip to content

fixed issue #965 Corrected redirection to Github and Nest profile and test files#998

Closed
KaranNegi20Feb wants to merge 10 commits intoOWASP:mainfrom
KaranNegi20Feb:corrected-linking
Closed

fixed issue #965 Corrected redirection to Github and Nest profile and test files#998
KaranNegi20Feb wants to merge 10 commits intoOWASP:mainfrom
KaranNegi20Feb:corrected-linking

Conversation

@KaranNegi20Feb
Copy link
Contributor

Fixes Issue
Issue: #965

Describe the bug
Buttons don't link to the github issue.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2025

Summary by CodeRabbit

  • New Features
    • Integrated clickable author profile links within issues, facilitating easier navigation.
    • Enhanced issue details now provide richer content for project and repository views.
    • Updates deliver a more intuitive and efficient interface on project and repository pages.
  • Refactor
    • Comment counts are displayed only when available, ensuring a cleaner display.
    • Layout improvements ensure full‐width rendering with refined spacing for a better overall experience.

Walkthrough

The changes remove assertions verifying the author's name from multiple test cases across Home, ProjectDetails, and RepositoryDetails pages. Additionally, the GraphQL query for project data now includes a url field for recent issues and author objects. UI component adjustments allow conditional rendering of comments in the DetailsCard and reorganize layout in the ItemCardList to include a more specific author link. No modifications were made to public API declarations.

Changes

Files Change Summary
frontend/__tests__/e2e/.../home.spec.ts, frontend/__tests__/unit/.../ProjectDetails.test.tsx, frontend/__tests__/unit/.../RepositoryDetails.test.tsx Removed assertions that verified the presence of author names in the "Recent Issues" sections of various test cases.
frontend/src/api/queries/projectQueries.ts Updated the GET_PROJECT_DATA GraphQL query to include a new url field in the recentIssues section and within its nested author object.
frontend/src/components/CardDetailsPage.tsx Refactored the DetailsCard component to conditionally render the comments count using optional chaining, displaying it only when item.commentsCount is truthy.
frontend/src/components/ItemCardList.tsx Reorganized the markup structure by separating the item title and author link, and adjusted classNames to improve layout and link specificity.
frontend/__tests__/e2e/.../ProjectDetails.spec.ts, frontend/__tests__/e2e/.../RepositoryDetails.spec.ts Introduced new test suites for Project Details and Repository Details pages, validating visibility of various elements and functionalities.

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • 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 to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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 our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (1)
frontend/src/components/CardDetailsPage.tsx (1)

99-104: Consider extracting comment display to a separate component

For better maintainability and code organization, consider extracting the comment display logic to a separate component, especially if this pattern is used in multiple places.

- {item?.commentsCount ? (
-   <>
-     <FontAwesomeIcon icon={faFileCode} className="ml-4 mr-2 h-4 w-4" />
-     <span>{item.commentsCount} comments</span>
-   </>
- ) : null}
+ <CommentCount count={item?.commentsCount} />

Where CommentCount could be defined as:

const CommentCount = ({ count }) => {
  if (!count) return null;
  
  return (
    <>
      <FontAwesomeIcon icon={faFileCode} className="ml-4 mr-2 h-4 w-4" />
      <span>{count} comments</span>
    </>
  );
};
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 76b9347 and f527f9e.

📒 Files selected for processing (6)
  • frontend/__tests__/e2e/pages/home.spec.ts (0 hunks)
  • frontend/__tests__/unit/pages/ProjectDetails.test.tsx (0 hunks)
  • frontend/__tests__/unit/pages/RepositoryDetails.test.tsx (0 hunks)
  • frontend/src/api/queries/projectQueries.ts (1 hunks)
  • frontend/src/components/CardDetailsPage.tsx (1 hunks)
  • frontend/src/components/ItemCardList.tsx (1 hunks)
💤 Files with no reviewable changes (3)
  • frontend/tests/e2e/pages/home.spec.ts
  • frontend/tests/unit/pages/ProjectDetails.test.tsx
  • frontend/tests/unit/pages/RepositoryDetails.test.tsx
🔇 Additional comments (5)
frontend/src/api/queries/projectQueries.ts (2)

19-19: Enhanced data retrieval for issue navigation

Adding the url field to the recentIssues section is a good enhancement that aligns with the PR objective of correcting redirection to GitHub issues.


24-24: Improved author profile linking capabilities

Adding the url field to the author object enables proper navigation to author profiles, which directly addresses the issue mentioned in PR #965 about correcting redirections.

frontend/src/components/ItemCardList.tsx (2)

23-44: Restructured item card for better navigation and layout

The changes properly implement the redirection fixes by:

  1. Adding proper author profile links using /community/users/${item?.author?.login}
  2. Using the newly added url field from the GraphQL query to link to the issue
  3. Improving the layout structure for better visual organization

These changes directly address the issue mentioned in PR #965 regarding corrected redirection to GitHub and Nest profiles.


27-28:

Details

✅ Verification successful

Verify URL format for author profiles

Ensure this URL format /community/users/${item?.author?.login} matches the expected route structure in your application's router.


🏁 Script executed:

#!/bin/bash
# Check if the routing path for user profiles exists in the codebase
echo "Searching for user profile route definition..."
rg -A 2 -B 2 "path.*(/community/users|community/users)" --glob "*.{tsx,jsx,ts,js}"

Length of output: 744


Routing URL Validation Confirmed
The route defined in frontend/src/App.tsx uses the /community/users/:userKey pattern, which is correctly matched by the link URL /community/users/${item?.author?.login} in ItemCardList.tsx. No changes are required as the URL format is consistent with the expected routing structure.

frontend/src/components/CardDetailsPage.tsx (1)

99-104: Improved UI with conditional comment display

The conditional rendering for comments count prevents displaying empty or undefined comment sections, making the UI cleaner and more user-friendly. This is a good practice that enhances the user experience.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
37.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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

🧹 Nitpick comments (5)
frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts (2)

68-69: Ensure author link test coverage

While the test verifies the author image is visible, it doesn't explicitly check if clicking on the author image navigates to the correct profile page. Consider adding a test that verifies this navigation functionality.

 await expect(page.getByRole('img', { name: 'Test User 1' })).toBeVisible()
+// Add test for author link navigation
+await page.getByRole('img', { name: 'Test User 1' }).click()
+await expect(page.url()).toContain('/users/test-user-1')
+await page.goto('/projects/test-project/repositories/test-repository') // Navigate back

73-78: Release author link check needed

Similar to the issue section, there's no test to verify that clicking on the release author's image navigates correctly to their profile page.

 await expect(page.getByRole('img', { name: 'Test User 2' })).toBeVisible()
 await expect(page.getByText('Jan 1, 2024', { exact: true })).toBeVisible()
+// Add test for release author link navigation
+await page.getByRole('img', { name: 'Test User 2' }).click()
+await expect(page.url()).toContain('/users/test-user-2')
frontend/__tests__/e2e/pages/ProjectDetails.spec.ts (3)

27-28: Ensure URL is a clickable link

The test verifies that the URL text is visible, but it doesn't check if it's a clickable link that would redirect to GitHub. Consider enhancing this test to verify the link functionality.

 await expect(page.getByText('URL: https://github.com/')).toBeVisible()
+// Check that the URL is a clickable link
+await expect(page.getByRole('link', { name: 'https://github.com/' })).toBeVisible()

73-74: Verify author profile link navigation

The test checks if the author image is visible but doesn't verify navigation to the author's profile. Consider adding a test for this functionality to ensure it meets the PR objective.

 await expect(page.getByRole('img', { name: 'Dave Debugger' })).toBeVisible()
+// Test author profile navigation
+await page.getByRole('img', { name: 'Dave Debugger' }).click()
+await expect(page.url()).toContain('/users/dave-debugger')
+await page.goto('/projects/test-project') // Navigate back to project page

98-99: Check for more repository links

The test only verifies navigation for "Repo One" but ignores "Repo Two". Consider testing both repository links to ensure comprehensive coverage.

 await page.getByText('Repo One').click()
 expect(page.url()).toContain('repositories/repo-1')
+// Navigate back and test the second repository link
+await page.goto('/projects/test-project')
+await page.getByText('Repo Two').click()
+expect(page.url()).toContain('repositories/repo-2')
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f527f9e and e44cdcb.

📒 Files selected for processing (2)
  • frontend/__tests__/e2e/pages/ProjectDetails.spec.ts (1 hunks)
  • frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts (1 hunks)
🔇 Additional comments (4)
frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts (2)

1-13: Test setup looks good

The setup code correctly routes GraphQL requests to use mock data before each test, which is a solid testing practice for isolating tests from external dependencies.


65-71: Tests align with PR objective

This test correctly validates the Recent Issues section, checking for the presence of author images and comment counts, which aligns with the PR objective of fixing links to GitHub and profile pages.

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

70-76: Good coverage of recent issues section

This test provides good coverage of the recent issues section, including author image and comment count, which aligns with the PR objective of fixing GitHub and profile redirections.


85-100: Effective repository navigation test

This test effectively validates that repository links are clickable and correctly redirect to the appropriate repository page, which directly addresses the PR objective of fixing redirection issues.

Comment on lines +24 to +26
await expect(page.getByText('Size: 1200 KB')).toBeVisible()
await expect(page.getByRole('link', { name: 'https://github.com/test-repo' })).toBeVisible()
})
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the GitHub URL format in the test

This test verifies that the repository URL is displayed and clickable, which directly relates to the PR's goal of fixing GitHub redirection. Ensure this URL format aligns with the actual URL pattern used in production.


🏁 Script executed:

#!/bin/bash
# Check how repository URLs are formatted in the actual code
rg -A 2 "github.com" --glob "*.tsx" --glob "*.ts" frontend/src/components/

Length of output: 1894


Update the expected GitHub URL in the test to match the production format

The production code builds GitHub URLs using a two-segment structure (e.g., https://github.com/OWASP/Nest or dynamically as https://github.com/<owner>/<repo>) while the RepositoryDetails test currently asserts the presence of a link with text "https://github.com/test-repo". Please update the test to include both the owner and repository segments (for example, "https://github.com/testOwner/test-repo" or an equivalent that mirrors the actual URL pattern in production) to fully align with the redirect fix requirements.

  • Action required: Modify the expected URL in frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts (around lines 24-26) so that it reflects the correct two-segment URL format.

@KaranNegi20Feb KaranNegi20Feb deleted the corrected-linking branch March 4, 2025 05:21
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.

2 participants