[CSM Portal Microapp] Fix comment author showing as "Unknown" for every commenter - #1367
Conversation
CaseCommentAuthorDto claimed createdBy was {id?, firstName?, lastName?,
fullName?}, but the backend actually sends the canonical UserReference shape
documented in openapi.yaml -- {id, email, name} -- confirmed live:
{"id":"bcc4881f-...","email":"anuradhab@wso2.com","name":"Anuradha Basnayake
W"}. None of fullName/firstName/lastName exist on that object, so
commentAuthorLabel's lookup always came up empty and fell through to
"Unknown", for every comment regardless of author.
Fix the DTO to match the real shape and read createdBy.name (falling back to
email) instead of the nonexistent fields.
|
Warning Review limit reached
Next review available in: 41 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe comment author DTO now requires nullable ChangesCase comment author handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Pull request overview
This PR fixes case comment author rendering by aligning the frontend DTO/model assumptions with the backend’s createdBy payload shape so author names no longer fall back to "Unknown" for all comments.
Changes:
- Updated
CaseCommentAuthorDtoto match the backend’s{ id, email, name }user reference shape. - Updated
commentAuthorLabelto prefercreatedBy.name, then fall back tocreatedBy.email, then"Unknown".
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/csm-portal/microapp/src/types/case.model.ts | Updates comment author display logic to use name/email from the author object. |
| apps/csm-portal/microapp/src/types/case.dto.ts | Updates the DTO type for comment authors to match the backend user reference shape. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…precedent A whitespace-only createdBy string, or a whitespace-only name/email, was truthy and so passed straight through -- rendering a blank-looking author instead of falling back to the next candidate or "Unknown". activity.model.ts's activityAuthorLabel (explicitly documented as mirroring this function's fallback chain) already trims every candidate; bring this one in line. Addresses Copilot review comment on wso2-open-operations#1367.
Summary
CaseCommentAuthorDtodeclaredcreatedByas{id?, firstName?, lastName?, fullName?}, but the backend actually sends the canonicalUserReferenceshape documented inopenapi.yaml—{id, email, name}. Confirmed live:{"id":"bcc4881f-...","email":"anuradhab@wso2.com","name":"Anuradha Basnayake ⓦ"}.fullName/firstName/lastNameexist on that object, socommentAuthorLabel's lookup always came up empty and fell through to"Unknown"— for every comment, from any author (customer or internal), not intermittently.commentAuthorLabelto readcreatedBy.name(falling back tocreatedBy.email, then"Unknown"only if genuinely absent).Test plan
tsc --noEmitpasseseslintpassesnpm run buildpasses/cases/{id}/comments/searchresponse —createdBy.namenow renders instead of falling through to "Unknown"Summary by CodeRabbit