Skip to content

Comments

Fix wrong timestamp shown on channel list item#6131

Merged
gpunto merged 2 commits intodevelopfrom
bug/AND-1044_fix_wrong_timestamp_on_channel_item
Feb 5, 2026
Merged

Fix wrong timestamp shown on channel list item#6131
gpunto merged 2 commits intodevelopfrom
bug/AND-1044_fix_wrong_timestamp_on_channel_item

Conversation

@VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Feb 5, 2026

Goal

The channel list item was displaying channel.lastMessageAt as the timestamp, which can differ from the actual shown message's createdAt time (ex. when the last message is deleted). This caused incorrect timestamps to be shown next to channel items.

This PR fixes the timestamp display by using the last message's createdAt property directly, instead of Channel.lastMessageAt

Implementation

  • Compose UI (ChannelItem.kt): Changed Timestamp(date = channel.lastMessageAt) to Timestamp(date = lastMessage.getCreatedAtOrNull())
  • XML UI (ChannelViewHolder.kt): Changed ChatUI.dateFormatter.formatDate(channel.lastMessageAt) to ChatUI.dateFormatter.formatDate(lastMessage.getCreatedAtOrNull())

Both the Compose and XML-based UI components now use the same source of truth for the timestamp.

🎨 UI Changes

before.mp4
after.mp4

Testing

  1. Open the channel list
  2. Open a channel
  3. Delete the last message
  4. Exit the channel
  5. Verify the timestamp matches the shown message in the channel item

☑️Contributor Checklist

General

  • I have signed the Stream CLA (required)
  • Assigned a person / code owner group (required)
  • Thread with the PR link started in a respective Slack channel (required internally)
  • PR targets the develop branch
  • PR is linked to the GitHub issue it resolves

Code & documentation

  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (KDocs, docusaurus, tutorial)

🎉 GIF

timestamp-fix

Summary by CodeRabbit

  • Bug Fixes
    • Updated last message timestamp calculation in channel lists to use the message creation date for improved accuracy across UI components.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@VelikovPetar VelikovPetar added the pr:bug Bug fix label Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.26 MB 5.26 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.63 MB 10.63 MB 0.00 MB 🟢
stream-chat-android-compose 12.85 MB 12.85 MB 0.00 MB 🟢

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 5, 2026

@VelikovPetar VelikovPetar marked this pull request as ready for review February 5, 2026 09:22
@VelikovPetar VelikovPetar requested a review from a team as a code owner February 5, 2026 09:22
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Walkthrough

Both channel list UI components now derive the last message timestamp from the lastMessage's createdAt property instead of the channel's lastMessageAt property, ensuring timestamp consistency with the actual message creation date.

Changes

Cohort / File(s) Summary
Timestamp Source Updates
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/ChannelItem.kt, stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/channels/.../ChannelViewHolder.kt
Replaced channel.lastMessageAt with lastMessage.getCreatedAtOrNull() for rendering the last message timestamp, sourcing the timestamp directly from the message object rather than the channel metadata. Added import for getCreatedAtOrNull utility function.

Suggested reviewers

  • gpunto

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Whiskers twitch with delight,
Timestamps dance in the light,
From message they spring,
No channel strings,
Truth flows where creation shines bright!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing incorrect timestamps displayed on channel list items.
Description check ✅ Passed The description covers the required template sections well: Goal explains the problem, Implementation details the changes in both Compose and XML UIs, Testing provides clear steps, and most critical checklist items are addressed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/AND-1044_fix_wrong_timestamp_on_channel_item

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 and usage tips.

@gpunto gpunto merged commit 12b5165 into develop Feb 5, 2026
17 checks passed
@gpunto gpunto deleted the bug/AND-1044_fix_wrong_timestamp_on_channel_item branch February 5, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants