Map the flag creation date and reviewer from their own fields by gpunto · Pull Request #6777 · GetStream/stream-chat-android · GitHub
Skip to content

Map the flag creation date and reviewer from their own fields - #6777

Merged
gpunto merged 1 commit into
developfrom
fix/flag-created-at-mapping
Oct 6, 2026
Merged

gpunto merged 1 commit into
developfrom
fix/flag-created-at-mapping

Conversation

@gpunto

@gpunto gpunto commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Flag.createdAt was mapped from approved_at and Flag.reviewedBy from created_at, so a new flag had a null createdAt and its creation timestamp in reviewedBy.

Closes AND-1610

Implementation

  • Map createdAt from created_at and reviewedBy from reviewed_by.
  • Type created_at as a date and reviewed_by as a string, as the backend sends them. A flag carrying a reviewer used to fail to parse.

Testing

The mapping test uses a distinct value per date, so a field mapped from the wrong source fails. FlagResponseParsingTest parses the backend's flag response, with and without a reviewer.

On a device, flagging a user and a message returned createdAt = null and the creation timestamp in reviewedBy before this change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Corrected moderation flag details so creation timestamps and reviewer information are displayed accurately.

@gpunto gpunto added the pr:bug Bug fix label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.18 MB 6.18 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.48 MB 11.48 MB 0.00 MB 🟢
stream-chat-android-compose 13.15 MB 13.15 MB 0.00 MB 🟢

@gpunto
gpunto marked this pull request as ready for review October 6, 2026 11:04
@gpunto
gpunto requested a review from a team as a code owner October 6, 2026 11:04
@gpunto
gpunto enabled auto-merge October 6, 2026 11:04
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4919d3b2-1ec3-4a44-a985-a81368adc9b3
📥 Commits

Reviewing files that changed from the base of the PR and between 64cc114 and dcd2514.

📒 Files selected for processing (5)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/DownstreamFlagDto.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/FlagResponseParsingTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

The flag DTO now represents created_at as a date and reviewed_by as a nullable string. Domain mapping reads each value from its corresponding field. Tests cover the mapping and flag response parsing.

Changes

Flag DTO Mapping

Layer / File(s) Summary
Flag DTO contract and mapping
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/DownstreamFlagDto.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
created_at now uses Date, and reviewed_by now uses String?. DownstreamFlagDto.toDomain() maps these fields to createdAt and reviewedBy.
Flag mapping and parsing tests
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DomainMappingTest.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/parser2/FlagResponseParsingTest.kt
Test data and mapping assertions use the updated DTO types and check distinct timestamp fields. New parsing tests check creation time, approval time, reviewer ID, and target user ID.

Priority: ➖ Normal

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

Change: Bug fix

Suggested reviewers: velikovpetar

Merge Risk: ⚪ Minimal · up to dcd25

Flag creation times and reviewer IDs now come from their corresponding response fields. The inspected parsing and mapping coverage leaves no identified issue requiring resolution before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: mapping the flag creation date and reviewer from their corresponding fields.
Description check ✅ Passed The description explains the goal, implementation, and testing. It omits the template’s UI, checklist, and GIF sections, which are not critical for this non-UI bug fix.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the flag fields in a row
Creation time and reviewer now align
Tests parse the response and confirm each
The dates and IDs settle into place
Then off hops the rabbit, pleased with the checks

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

@andremion andremion 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.

Looks good.

@gpunto
gpunto disabled auto-merge October 6, 2026 14:33
@gpunto
gpunto added this pull request to the merge queue Oct 6, 2026
Merged via the queue into develop with commit 6e63de4 Oct 6, 2026
20 of 21 checks passed
@gpunto
gpunto deleted the fix/flag-created-at-mapping branch October 6, 2026 15:10
@stream-public-bot stream-public-bot added the released Included in a release label Oct 8, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Bug fix released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants