RocketChat / RocketChat/Rocket.Chat.ReactNative

Channel timestamp differs from web after deleting message

Open
#5,304 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🔍 triaged
Dominant language
TypeScript
Stars
2.4k
Forks
1.5k
Avg merge
1d 18h
Merged PRs (30d)
90

Description

Description:

After deleting the most recent message in a channel, app and web show different timestamps for that channel.

Environment Information:
  • Rocket.Chat Server Version: 6.4.4
  • Rocket.Chat App Version: 4.42.0.50842
  • Device Name: ELE-L29 (Huawei P30)
  • OS Version: EMUI 12.0.0 (Android 11)
Steps to reproduce:
  1. Write one message in any channel.
  2. Wait at least one minute.
  3. Write a second message.
  4. Delete the second message.
  5. In the channel lists in both app and web, have a look at the timestamp of the channel.

For step 5, you need the display mode for the web to be set to "Extended".

Expected behavior:

The timestamps are identical.

Actual behavior:

The timestamps are different. This is confusing.

When reproducing this issue, I wrote two messages:

  • "bla" at 11:24 PM.
  • "wtf" at 11:26 PM.

In the web version, these messages look like this:

image

The channel in the channel list in the web version:

image

And in the app:

image

As expected, both show the message "wtf" with the timestamp 11:26 PM.

After deleting the second message, this is how the channel looks like in the web version:

image

And in the app:

image

Now both show the message "bla" as the last one, but the web version shows 11:24 PM while the app shows 11:26 PM. In my opinion, this is confusing.

Additional context:

Web and app may use different sources for the timestamp. This is the JSON for the channel after deleting the message, straight from MongoDB:

{
  "_id": "GENERAL",
  "ts": "2021-07-30T10:40:12.101Z",
  "t": "c",
  "name": "general",
  "usernames": [],
  "msgs": 473,
  "usersCount": 12,
  "default": true,
  "_updatedAt": "2023-10-27T21:30:56.334Z",
  "lastMessage": {
    "_id": "HKvEmqHggRgmWdZr4",
    "rid": "GENERAL",
    "msg": "bla",
    "ts": "2023-10-27T21:24:07.838Z",
    "u": {
      "_id": "xq7oE4mtb2nEcfe2m",
      "username": "paulchen",
      "name": "xx"
    },
    "_updatedAt": "2023-10-27T21:24:07.872Z",
    "urls": [],
    "mentions": [],
    "channels": [],
    "md": [
      {
        "type": "PARAGRAPH",
        "value": [
          {
            "type": "PLAIN_TEXT",
            "value": "bla"
          }
        ]
      }
    ]
  },
  "lm": "2023-10-27T21:26:08.628Z",
  "announcement": "https://youtu.be/E8gmARGvPlI",
  "topic": "https://youtu.be/E8gmARGvPlI",
  "joinCodeRequired": false
}

The app seems to use lm which has the value 2023-10-27T21:26:08.628Z.

Web seems to use lastMessage.ts which has the value 2023-10-27T21:24:07.838Z. It does not use lastMessage._updatedAt. This can be verified by editing the message which will change lastMessage._updatedAt while leaving lastMessage.ts unchanged. Web will still show 11:24 PM.

Maybe the problem actually is that lm should be updated when deleting the most recent message. In that case, this issue belongs to the Rocket.Chat server instead of the app.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the deletion flow and comparing the app's channel-list timestamp from lm with the web timestamp from lastMessage.ts, using the JSON and steps in the issue. Determine whether the correction belongs in Rocket.Chat.ReactNative or the server; done means the app and web show the same timestamp after the latest message is deleted.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.