element-x-android icon indicating copy to clipboard operation
element-x-android copied to clipboard

Replying to own message causes notification

Open Kladki opened this issue 1 year ago • 2 comments

Steps to reproduce

  1. Send a message
  2. Reply to that message

Outcome

What did you expect?

I expected to not get a notification and be mentioned

What happened instead?

I was mentioned and received a notification. Looking at the event content I am inside the m.mentions field:

{
  "content": {
    "body": "> <@matthias:ahouansou.cz> Hello! This is a message.\n\nAnd this is a reply.",
    "format": "org.matrix.custom.html",
    "formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!YkAbdfb6bbg6RphR2w:conduit-test-server.ahouansou.cz/$xyrOP-YGW8zMKXRsb77ljREdPTuBX_fo9Rvvv8ZtGik\">In reply to</a> <a href=\"https://matrix.to/#/@matthias:ahouansou.cz\">@matthias:ahouansou.cz</a><br>Hello! This is a message.</blockquote></mx-reply>And this is a reply.",
    "m.mentions": {
      "user_ids": [
        "@matthias:ahouansou.cz"
      ]
    },
    "m.relates_to": {
      "m.in_reply_to": {
        "event_id": "$xyrOP-YGW8zMKXRsb77ljREdPTuBX_fo9Rvvv8ZtGik"
      }
    },
    "msgtype": "m.text"
  },
  "event_id": "$75UjZu-cwB4rrCwjlS3nc1QWBM7McNP3aJuX9VjQMss",
  "origin_server_ts": 1712570046730,
  "sender": "@matthias:ahouansou.cz",
  "type": "m.room.message",
  "unsigned": {
    "age": 1,
    "transaction_id": "229a3ef8bd774b9c8876de9d4f93ee77"
  },
  "room_id": "!YkAbdfb6bbg6RphR2w:conduit-test-server.ahouansou.cz"
}

The spec specifically says not to do this:

Users should not add their own Matrix ID to the m.mentions property as outgoing messages cannot self-notify.

https://spec.matrix.org/v1.10/client-server-api/#user-and-room-mentions

Your phone model

Redmi Note 9 Pro

Operating system version

Android 12

Application version and app store

0.4.7

Homeserver

Conduit 0.7.0-alpha (2c73c3ad)

Will you send logs?

Yes

Are you willing to provide a PR?

No

Kladki avatar Apr 08 '24 10:04 Kladki

The mention of the original message is added by Ruma here:

https://github.com/ruma/ruma/blob/047764bc151b4bdfcd90126357029ace297290f0/crates/ruma-events/src/room/message/without_relation.rs#L128

I have created an issue over there: https://github.com/ruma/ruma/issues/1770

bmarty avatar Apr 08 '24 15:04 bmarty

@bmarty This issue can be marked as solved once Element X Android has updated the Rust SDK.

Hywan avatar Apr 23 '24 08:04 Hywan

@Hywan perfect, thanks!

bmarty avatar Jun 12 '24 08:06 bmarty