feat: add recent pull requests to public module page#3516
Conversation
Summary by CodeRabbitRelease Notes
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis PR introduces a feature to display related pull requests on module view pages. It adds a GraphQL resolver to fetch recent pull requests linked to module issues, creates a new MentorshipPullRequest component to render PR details, updates the CardDetailsPage to conditionally display PRs for modules, and expands GraphQL queries to include PR author information. Tests are added to verify the rendering and expansion behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
kasya
left a comment
There was a problem hiding this comment.
@HarshitVerma109 hi! Left some comments ⬇️
I also found an issue with padding for the new milestone block.
I will push that fix (really tiny) to this PR if you don't mind.
There was a problem hiding this comment.
Can we somehow specify that this is a mentorship view PR list in the name? I can see how this could now be confusing between regular RecentPullRequests component and PullRequestList component.
also, do you think it would make sense for component to be an actual item you're building with a map and not the whole list? 🤔
There was a problem hiding this comment.
Also, it would be good to add a Load more button to this view at some point that would load more PRs - can totally do it in a separate task. I was expecting to see more items initially, since I knew there were way more than 5 PRs open for the label I use.
Just a thought, don't need to add it right now.
There was a problem hiding this comment.
I have implemented the 'Show More/Less' toggle. Please let me know if this meets the requirements.
|
kasya
left a comment
There was a problem hiding this comment.
@HarshitVerma109 this looks good 👍🏼 Thank you!
| def recent_pull_requests(self, limit: int = 5) -> list[PullRequestNode]: | ||
| """Return recent pull requests linked to issues in this module.""" | ||
| issue_ids = self.issues.values_list("id", flat=True) | ||
| return list( | ||
| PullRequest.objects.filter(related_issues__id__in=issue_ids) | ||
| .select_related("author") | ||
| .distinct() | ||
| .order_by("-created_at")[:limit] | ||
| ) | ||
|
|
There was a problem hiding this comment.
@HarshitVerma109 What I meant by Show more button is more like a pagination. Right now the limit is still 5, so at most you'll go from 4 to 5 items when clicking Show more.
The idea is to allow loading more PRs on request from user. This might be a bit more tricky and as I said before we can (and probably should) work on that in a separate task.



Proposed change
Resolves #3380
PullRequestList.tsxcomponent to standardize the PR display.PullRequestList, ensuring a consistent UI across the application.Checklist
make check-testlocally: all warnings addressed, tests passed