Story 2452: User Profile Integration – Contribution Bio - #2533
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@users/models.py`:
- Line 660: Update the data population logic at the display_name_short reference
to invoke the library method and append its returned name rather than the bound
method object.
In `@users/tasks.py`:
- Line 207: Guard the cache invalidation in users/tasks.py at the
contributor-data cache cleanup with hasattr(cache, "delete_pattern"), using a
safe fallback such as cache.clear() when unavailable; also update
users/tests/test_profile_role.py lines 33-35 with the same guard so local-memory
cache backends work. For production, avoid blocking Redis KEYS behavior by using
versioning or configuring django-redis for SCAN/ITERMAP.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 63c5daf2-fbd9-4d49-9d4a-0acfadb4f882
📒 Files selected for processing (5)
config/settings.pyusers/models.pyusers/tasks.pyusers/tests/test_profile_role.pyusers/views.py
46a9d39 to
554fd57
Compare
f2a5177 to
4df420f
Compare
554fd57 to
fb6ed64
Compare
4df420f to
88aa0b4
Compare
fb6ed64 to
bbf2571
Compare




Issue: #2452
Summary & Context
Populates the bio card on the user profile page with each user's real library contributions instead of the hardcoded demo dict. Contributions are grouped by role (Author, Maintainer, Contributor), sourced from the same role data that backs the Edit User profile role dropdown.
Changes
Wire real contribution data to the bio card
User.get_contributor_data()— returns library contributions grouped by role label ({role: [library, …]}), in precedence order Author → Maintainer → Contributor, with each role's libraries ordered by commit count. Reuses the existingget_role_library_options()source of truth rather than adding new queries.contributor_datafrom the real query onCurrentUserProfileViewCache the computed data
CONTRIBUTOR_DATA_CACHE_TIMEOUT, default 24h), keyed per user. An empty dict is cached as a real value, distinct from a miss.recompute_displayed_profile_roles(viadelete_pattern), the task already run after every author/maintainer/commit import and on the daily beat — so the cache clears whenever the underlying data actually changes. The TTL is only a backstop for a missed invalidation.Risks & Considerations
recompute_displayed_profile_roles→ cache clear), so no signal-based invalidation is wired. The one uncovered path is a direct edit of authors/maintainers on theLibraryVersionadmin form; that would show stale data until the next import or the 24h TTL. Acceptable because that admin edit isn't part of the real workflow. If it ever becomes one, we can add anm2m_changedsignal on the through models.Peer-Testing Guidelines
Screenshots
Self-review Checklist
Frontend
Summary by CodeRabbit
New Features
Bug Fixes