element-ios icon indicating copy to clipboard operation
element-ios copied to clipboard

Incorrect syntax for user mentions

Open progval opened this issue 2 years ago • 3 comments

Steps to reproduce

Mention a user from Element iOS nightly. For example: "I DMed tpb about what’s going on but I suspect I’m just talking to a bot/service. 🤔"

Outcome

What did you expect?

This event was sent:

According to the spec:

  • https://spec.matrix.org/v1.7/client-server-api/#mroommessage-msgtypes

Something like this should be sent:

{
  "content": {
    "body": "I DMed tpb about what’s going on but I suspect I’m just talking to a bot/service. 🤔",
    "format": "org.matrix.custom.html",
    "formatted_body": "I DMed <a href=\"https://matrix.to/#/@libera_tpb:catircservices.org\">tpb</a> about what’s going on but I suspect I’m just talking to a bot/service. 🤔",
    "msgtype": "m.text"
  },
  ...
}

allowing matrix-appservice-irc to translate it to:


<jevinskie[m]1> I DMed tpb about what’s going on but I suspect I’m just talking to a bot/service. 🤔

What happened instead?

{
  "content": {
    "body": "I DMed [tpb](<https://matrix.to/#/@libera_tpb:catircservices.org>) about what’s going on but I suspect I’m just talking to a bot/service. 🤔",
    "format": "org.matrix.custom.html",
    "formatted_body": "I DMed <a data-mention-type=\"user\" contenteditable=\"false\" href=\"https://matrix.to/#/@libera_tpb:catircservices.org\">tpb</a> about what’s going on but I suspect I’m just talking to a bot/service. 🤔",
    "msgtype": "m.text"
  },
  "origin_server_ts": 1690466951796,
  "room_id": "!LhJjrGmNCUyJajtYYf:catircservices.org",
  "sender": "@jevinskie:matrix.org",
  "type": "m.room.message",
  "unsigned": {
    "age": 4266509
  },
  "event_id": "$30s5H_bel7LYbK_APhXlljW-hXq1bgSiQKjkzeLe-4Q",
  "user_id": "@jevinskie:matrix.org",
  "age": 4266509
}

https://matrix.to/#/!LhJjrGmNCUyJajtYYf:catircservices.org/$30s5H_bel7LYbK_APhXlljW-hXq1bgSiQKjkzeLe-4Q?via=matrix.org&via=catircservices.org

which causes the following to be sent to IRC through matrix-appservice-irc:

<jevinskie[m]1> I DMed [tpb](<https://matrix.to/#/@libera_tpb:catircservices.org>) about what’s going on but I suspect I’m just talking to a bot/service. 🤔

(which then triggers URL snippet fetching, which is very noisy)

Your phone model

No response

Operating system version

No response

Application version

nightly, 1.10.14 (20230621144257)

Homeserver

No response

Will you send logs?

No

progval avatar Jul 27 '23 15:07 progval

Here are the message contents. I tried Element X and it doesn't even have the functionality to tap a name to make a mention pill. And indeed I'm on 1.10.14 (20230621144257) from TestFlight.

https://gist.github.com/jevinskie/19fd0fbd7903e1586b5e8b8c6f8cd3a5

jevinskie avatar Jul 27 '23 18:07 jevinskie

OK so changing mode: .markdown to mode: .displayname here makes the Markdown that doesn't render in IRC clients go away and also fixes the "bot sees a link" issue. Unfortunately it doesn't display a pill in Element anymore.

View from Element View from IRC

jevinskie avatar Jul 27 '23 22:07 jevinskie

Thank you for triaging as "Major".

whitequark avatar Jul 29 '23 08:07 whitequark