Skip to content

[CSM Portal Microapp] Fix comment author showing as "Unknown" for every commenter - #1367

Merged
Rashmika998 merged 2 commits into
wso2-open-operations:mainfrom
2003dinijay:fix/comment-author-unknown
Aug 5, 2026
Merged

Rashmika998 merged 2 commits into
wso2-open-operations:mainfrom
2003dinijay:fix/comment-author-unknown

Conversation

@2003dinijay

@2003dinijay 2003dinijay commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • CaseCommentAuthorDto declared createdBy as {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 ⓦ"}.
  • 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, from any author (customer or internal), not intermittently.
  • Fixed the DTO to match the real shape and updated commentAuthorLabel to read createdBy.name (falling back to createdBy.email, then "Unknown" only if genuinely absent).

Test plan

  • tsc --noEmit passes
  • eslint passes
  • npm run build passes
  • Verified against a real /cases/{id}/comments/search response — createdBy.name now renders instead of falling through to "Unknown"

Summary by CodeRabbit

  • Bug Fixes
    • Improved case comment author information display by using the author’s name, with email shown as a fallback when needed.
    • Standardized comment author details for more consistent case views.

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.
Copilot AI lite review requested due to automatic review settings August 5, 2026 04:26
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@2003dinijay, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f91254f3-c625-42ee-bd9e-d666ed1dd434

📥 Commits

Reviewing files that changed from the base of the PR and between 27518e7 and 7a10868.

📒 Files selected for processing (1)
  • apps/csm-portal/microapp/src/types/case.model.ts
📝 Walkthrough

Walkthrough

The comment author DTO now requires nullable id, email, and name. Comment author labels now prefer name, then email, with "Unknown" as the final fallback.

Changes

Case comment author handling

Layer / File(s) Summary
Author contract and label resolution
apps/csm-portal/microapp/src/types/case.dto.ts, apps/csm-portal/microapp/src/types/case.model.ts
CaseCommentAuthorDto now requires id, email, and name. Object-form comment authors resolve labels from name, then email, then "Unknown".

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: Type/Improvement

Suggested reviewers: copilot, rashmika998

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the cause, fix, and tests, but it omits most sections required by the repository template. Add the required sections, including Purpose, Goals, Approach, release note, documentation, security checks, automation details, and test environment.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the primary fix: comment authors no longer display as "Unknown" in the CSM Portal Microapp.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 CaseCommentAuthorDto to match the backend’s { id, email, name } user reference shape.
  • Updated commentAuthorLabel to prefer createdBy.name, then fall back to createdBy.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.

Comment thread apps/csm-portal/microapp/src/types/case.model.ts
@2003dinijay 2003dinijay changed the title Fix comment author showing as "Unknown" for every commenter [CSM Portal Microapp] Fix comment author showing as "Unknown" for every commenter Aug 5, 2026
…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.
@Rashmika998
Rashmika998 merged commit 9885274 into wso2-open-operations:main Aug 5, 2026
1 check passed
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.

3 participants