Skip to content

Conversation

@rishyym0927
Copy link
Contributor

@rishyym0927 rishyym0927 commented Jun 8, 2025

This PR improves the Recent Releases card component with the following changes:

  • Fixes Improve recent releases card #1537

  • Ensures that each release item displays a readable name: if the release name is absent, the tagName is shown as a fallback.

  • Fixes the release link: if the url is missing or invalid, the link now correctly points to the organization's repository release page using the organization, repository, and tag.

  • No changes are required in the backend as long as all necessary fields (name, tagName, url, organizationName, repositoryName) are present in the API response.

  • These changes address issues where releases from external organizations were missing information or had incorrect links. No unrelated code was modified.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 8, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of missing or incomplete author and release data in the recent releases list, resulting in more accurate display and fewer empty or broken elements.
    • Enhanced conditional rendering for avatars, tooltips, and links to ensure consistent and reliable UI behavior.

Walkthrough

The code refines the conditional rendering and fallback logic in the RecentReleases.tsx component. It improves how author avatars, links, release names, and repository navigation are handled, using nullish coalescing for more precise fallbacks and ensuring URLs and display names are constructed accurately based on available data.

Changes

Cohort / File(s) Change Summary
Recent Releases Rendering Logic
frontend/src/components/RecentReleases.tsx
Refined conditional rendering for author avatars, improved fallback handling using nullish coalescing, updated release and author link construction, and ensured release name fallback to tag when absent.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
Use tag as release name fallback if title is absent (#1537)
Construct release URL to organization's repository release page, not Nest main page (#1537)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related PRs

Suggested reviewers

  • kasya

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2094586 and f5d4562.

📒 Files selected for processing (1)
  • frontend/src/components/RecentReleases.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/RecentReleases.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Run spell check
  • GitHub Check: Run pre-commit checks
  • GitHub Check: Run frontend checks
  • GitHub Check: CodeQL (python)
  • GitHub Check: CodeQL (javascript-typescript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6b0757a and a7f3bc7.

📒 Files selected for processing (1)
  • frontend/src/components/RecentReleases.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
frontend/src/components/RecentReleases.tsx (1)
frontend/src/components/TruncatedText.tsx (1)
  • TruncatedText (3-45)
🔇 Additional comments (1)
frontend/src/components/RecentReleases.tsx (1)

78-78: LGTM! Proper fallback implementation.

The fallback logic correctly displays the tag name when the release name is missing, which aligns perfectly with the PR objectives. The use of optional chaining ensures safe property access.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

Thanks for working on this.
One big issue I found ⬇️

@kasya
Copy link
Collaborator

kasya commented Jun 14, 2025

@rishyym0927 Hi! Any updates on this one?

@rishyym0927
Copy link
Contributor Author

@kasya can you clarify one thing, that if the url is not present then what should I use in replacement of that or how to deal with it? Also what if the tag name or title name both are missing how can we deal with it then? shouldn't we make these fields mandatory at the backend part ?

@rishyym0927 rishyym0927 requested a review from kasya June 14, 2025 12:49
@kasya
Copy link
Collaborator

kasya commented Jun 15, 2025

@kasya can you clarify one thing, that if the url is not present then what should I use in replacement of that or how to deal with it? Also what if the tag name or title name both are missing how can we deal with it then? shouldn't we make these fields mandatory at the backend part ?

@rishyym0927 the item you work with doesn't have a url property on it. You need to update the backend to pass it in.

I would recommend you to check how links for releases work on the organization page. It's the same component.
Also, maybe look at GraphQL to check what data is available on the backend

@kasya
Copy link
Collaborator

kasya commented Jun 15, 2025

Also, tests are failing now. Please run make check and make test after addressing this and before pushing changes 👌🏼

@rishyym0927
Copy link
Contributor Author

image

Hey @kasya as I can see that the graphql query return the url in recentReleases, so it does have the url property in it. What goes wrong is I gues that sometimes the when url link is not received then it basically redirect to home page of the nest where as we shoudl redirect it not found page. IF im correct then can I mplement this solution cause I dont think there is any need of making changes in hte backend as of now

@rishyym0927 the item you work with doesn't have a url property on it. You need to update the backend to pass it in.

I would recommend you to check how links for releases work on the organization page. It's the same component. Also, maybe look at GraphQL to check what data is available on the backend

Hey @kasya,
Thanks for the suggestion!

I checked the GraphQL query, and it looks like the recentReleases does return the url property. From what I observed, the issue seems to occur when the url is not present for a particular release — in such cases, it redirects to the home page of Nest. Ideally, we should redirect to a 404 or a "Not Found" page instead.

If my understanding is correct, would it make sense for me to implement this behavior on the frontend? I believe this might be sufficient for now, without requiring changes on the backend — but happy to discuss further if you think otherwise.

Let me know what you think!

@rishyym0927
Copy link
Contributor Author

I implemented a new solution which works pretty well, even if the url fiield is missing @kasya

@kasya
Copy link
Collaborator

kasya commented Jun 15, 2025

Hey @kasya, Thanks for the suggestion!

I checked the GraphQL query, and it looks like the recentReleases does return the url property. From what I observed, the issue seems to occur when the url is not present for a particular release — in such cases, it redirects to the home page of Nest. Ideally, we should redirect to a 404 or a "Not Found" page instead.

Let me know what you think!

@rishyym0927 have you compared the data on those 2 pages? The data that is sent to the project page releases does have the url property on it.
Screenshot 2025-06-15 at 12 52 19 PM

But you don't have it in the objects you work with on the repo page.
Screenshot 2025-06-15 at 12 52 29 PM

GraphQL only shows you what's available - not necessarily all of it was sent to the frontend. And that's exactly the case for this page.

@rishyym0927
Copy link
Contributor Author

Hey @kasya, Thanks for the suggestion!
I checked the GraphQL query, and it looks like the recentReleases does return the url property. From what I observed, the issue seems to occur when the url is not present for a particular release — in such cases, it redirects to the home page of Nest. Ideally, we should redirect to a 404 or a "Not Found" page instead.
Let me know what you think!

@rishyym0927 have you compared the data on those 2 pages? The data that is sent to the project page releases does have the url property on it. Screenshot 2025-06-15 at 12 52 19 PM

But you don't have it in the objects you work with on the repo page. Screenshot 2025-06-15 at 12 52 29 PM

GraphQL only shows you what's available - not necessarily all of it was sent to the frontend. And that's exactly the case for this page.

Hey @kasya,
Thank you so much for the clarification and the screenshots — that really helped me understand the gap better.

You're absolutely right — I hadn’t compared the data between the project page and the repo page closely enough. I now see that while the GraphQL query can return the url, it isn’t being passed to the frontend in the repo page context, which is likely why the redirection issue occurs there.

Apologies for the oversight on my part. I’ll dig into this further

kasya
kasya previously approved these changes Jun 30, 2025
Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

I cleaned this up a bit (removed prev.added logic for working with dates that was not needed, we have a formatDate() util that takes care of that).

Also pushed missing part with getting url for a release in repository query.
This works fine now! 👌🏼

@kasya kasya added this pull request to the merge queue Jul 28, 2025
@kasya kasya removed this pull request from the merge queue due to a manual request Jul 28, 2025
@github-actions github-actions bot removed the backend label Aug 2, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 2, 2025

@arkid15r arkid15r added this pull request to the merge queue Aug 2, 2025
Merged via the queue into OWASP:main with commit f063291 Aug 2, 2025
23 of 24 checks passed
trucodd pushed a commit to trucodd/Nest that referenced this pull request Aug 5, 2025
…Ls (OWASP#1566)

* fix

* Update frontend/src/components/RecentReleases.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix

* Fix

* Fix

* Update query to pass in release url to repository data

* Update code

* Update code

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Kate Golovanova <[email protected]>
Co-authored-by: Arkadii Yakovets <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve recent releases card

3 participants