Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of pinned messages includes message editing history #5751

Open
paulchen opened this issue Jun 18, 2024 · 3 comments
Open

List of pinned messages includes message editing history #5751

paulchen opened this issue Jun 18, 2024 · 3 comments

Comments

@paulchen
Copy link

Description:

In the list of pinned messages for a certain channel, messages that have been edited are shown multiple times.

Environment Information:

  • Rocket.Chat Server Version: 6.9.0
  • Rocket.Chat App Version: 4.49.2.61945
  • Device Name: Pixel 8
  • OS Version: Android 14, security update 5 June 2024

Steps to reproduce:

  1. Login as an admin and make sure "Keep Per Message Editing History" is enabled as described in https://docs.rocket.chat/use-rocket.chat/user-management/message-auditor/audit-edits-deletions-and-encrypted-communications.
  2. Login with a user that has the "Pin Message" privilege for a certain channel.
  3. Navigate to that channel.
  4. Write a message and submit it.
  5. Pin that message.
  6. By clicking on the channel name and choosing "Pinned", make sure you see the message there.
  7. Now go back and edit the message.
  8. Click on the channel name again and choose "Pinned".

Expected behavior:

Only the current version of the message is shown.

Actual behavior:

Both the current and the old version of the message are shown.

pinned-messages-issue.mp4

Additional context:

Apparently, the app (or Rocket.Chat's backend API) lacks a condition to filter out old revisions of messages.

An item of the message editing history contains the keys parent and hidden which may be used for such a condition:

{
  "_id": "6671e3bc6457df225bc89d9e",
  "rid": "6671e39a6457df225bc89d9a",
  "msg": "test",
  "ts": "2024-06-18T19:44:38.745Z",
  "u": {
    "_id": "xq7oE4mtb2nEcfe2m",
    "username": "paulchen",
    "name": "xx"
  },
  "_updatedAt": "2024-06-18T19:45:00.678Z",
  "urls": [],
  "mentions": [],
  "channels": [],
  "md": [
    {
      "type": "PARAGRAPH",
      "value": [
        {
          "type": "PLAIN_TEXT",
          "value": "test"
        }
      ]
    }
  ],
  "pinned": true,
  "pinnedAt": "2024-06-18T19:44:47.656Z",
  "pinnedBy": {
    "_id": "xq7oE4mtb2nEcfe2m",
    "username": "paulchen"
  },
  "_hidden": true,
  "parent": "EfxP8yY3hZe4Isgge",
  "editedAt": "2024-06-18T19:45:00.678Z",
  "editedBy": {
    "_id": "xq7oE4mtb2nEcfe2m",
    "username": "paulchen"
  }
}

The current revision of the message does not include these keys:

{
  "_id": "EfxP8yY3hZe4Isgge",
  "rid": "6671e39a6457df225bc89d9a",
  "msg": "test test",
  "ts": "2024-06-18T19:44:38.745Z",
  "u": {
    "_id": "xq7oE4mtb2nEcfe2m",
    "username": "paulchen",
    "name": "xx"
  },
  "_updatedAt": "2024-06-18T19:45:00.735Z",
  "urls": [],
  "mentions": [],
  "channels": [],
  "md": [
    {
      "type": "PARAGRAPH",
      "value": [
        {
          "type": "PLAIN_TEXT",
          "value": "test test"
        }
      ]
    }
  ],
  "pinned": true,
  "pinnedAt": "2024-06-18T19:44:47.656Z",
  "pinnedBy": {
    "_id": "xq7oE4mtb2nEcfe2m",
    "username": "paulchen"
  },
  "editedAt": "2024-06-18T19:45:00.731Z",
  "editedBy": {
    "_id": "xq7oE4mtb2nEcfe2m",
    "username": "paulchen"
  }
}
@diegolmello
Copy link
Member

Looks like an issue on backend, right? @paulchen

@paulchen
Copy link
Author

Looks like an issue on backend, right? @paulchen

Maybe.

However, I don't know the design of the app.

  • Maybe the backend API lacks filtering.
  • Maybe the app calls the backend API with a wrong set of input parameters to only fetch current revisions of messages.
  • Maybe the idea was to fetch all messages together with their history and do the filtering in the app.

Therefore, I reported the problem for the app where I observed it.

As an additional information, the web version works correctly:

image

gursewaktut added a commit to gursewaktut/Rocket.Chat.ReactNative that referenced this issue Jun 28, 2024
@gursewaktut
Copy link

Hi @diegolmello, I believe I have fixed this issue.

screen-20240627-223109.mp4

Can you assign this issue to me? and I will link the pull request to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants