Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Android app shows ghost lastMessage after user deletion (room.lastMessage not cleaned up) #36885

Copy link
Copy link
@steffen-moser

Description

@steffen-moser
Issue body actions

Description:

When a user is deleted from Rocket.Chat, all of their messages are removed from the rocketchat_message collection. However, if one of these messages was the last message in a room, the lastMessage field in the corresponding rocketchat_room document is not cleaned up.

This results in a ghost message that is only visible on the Android mobile client. The web and desktop clients ignore the dangling lastMessage pointer.


Steps to reproduce:

  1. Create a room (e.g., #general).
  2. Post a message in the room as User A.
  3. Delete User A from the system.
    • The message disappears from the rocketchat_message collection.
    • But the room document (rocketchat_room) still has the message stored in its lastMessage field.
  4. Open the room on the Android mobile app → the ghost message is shown.
  5. Open the same room in the browser or desktop client → no ghost message is shown.

Expected behavior:

  • When a user (and their messages) are deleted, the lastMessage field in rocketchat_room should be cleared or updated to point to the latest valid message.
  • No ghost messages should appear in any client.

Actual behavior:

  • Ghost message still appears in Android mobile client.
  • The message is not in rocketchat_message anymore.
  • The room’s lastMessage field still references it.
  • Web and desktop clients do not display it, but Android does.

Server Setup Information:

  • Version of Rocket.Chat Server: 7.10.0
  • License Type: Community
  • Number of Users: 20
  • Operating System: Ubuntu 24.04 LTS
  • Deployment Method: Docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Disabled
  • NodeJS Version: 22.16.0
  • MongoDB Version: 6.0.13

Client Setup Information

  • Desktop App or Browser Version: 4.9.0 / Firefox 142.0.1

  • Operating System: Linux, macOS, Windows

  • Mobile App: Android Rocket.Chat app (latest release from Play Store): 4.63.0.96963


Additional context

  • The issue only affects mobile clients (tested on multiple Android devices).
  • It seems the Android app uses the lastMessage field in rocketchat_room to render channel previews, while web/desktop clients query rocketchat_message directly.
  • Manual workaround:
    db.rocketchat_room.updateOne(
      { _id: "GENERAL" },
      { $unset: { lastMessage: "" } }
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.