element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.37k stars 719 forks source link

Edit fallback fails when edit event itself is broken #686

Open olmari opened 4 years ago

olmari commented 4 years ago

Relates to https://github.com/matrix-org/matrix-appservice-slack/issues/322 much, where currently appservice-slack doesn't generate proper edit event towards matrix when slacker has edited an message. While that is ofcourse bug on it's own, riotX fails to show the fallback edit nor the "real" edit, resulting that user on riotX will not see any edit being done, when there is one done...

Screenshots: riotX (see no edit nor fallback seen) riotX riot-android (see only fallback as nothign else is supported) riot-andoid riot-web (shows fallback because actual edit event is broken, this is how riotX should show it too) riot-web

Message sources, Original message:

{
  "type": "m.room.message",
  "sender": "@slack_helsinkihacklab_<redacted>:hacklab.fi",
  "content": {
    "body": "Turvaominaisuus, ei saa ainakaan molempia käsiä liikkuvien osien cäliin!",
    "format": "org.matrix.custom.html",
    "formatted_body": "Turvaominaisuus, ei saa ainakaan molempia käsiä liikkuvien osien cäliin!",
    "msgtype": "m.text"
  },
  "event_id": "$15737336231061FYGFD:hacklab.fi",
  "origin_server_ts": 1573733623423,
  "unsigned": {
    "age": 1125
  },
  "room_id": "!MjVdMmsFAxVzHUZLiV:matrix.org"
}

And from the edit:

{
  "type": "m.room.message",
  "sender": "@slack_helsinkihacklab_<redacted>:hacklab.fi",
  "content": {
    "body": "(edited) ... osien  cäliin!  => ... osien  väliin!  ",
    "format": "org.matrix.custom.html",
    "formatted_body": "<i>(edited)</i> ... osien  <font color=\"red\"> cäliin! </font>  =&gt; ... osien <font color=\"green\"> väliin! </font> ",
    "m.new_content": {
      "body": "Turvaominaisuus, ei saa ainakaan molempia käsiä liikkuvien osien väliin!",
      "format": "org.matrix.custom.html",
      "formatted_body": "Turvaominaisuus, ei saa ainakaan molempia käsiä liikkuvien osien väliin!",
      "msgtype": "m.text"
    },
    "m.relates_to": {
      "rel_type": "m.replace"
    },
    "msgtype": "m.text"
  },
  "event_id": "$15737336241062ZmRbl:hacklab.fi",
  "origin_server_ts": 1573733624638,
  "unsigned": {
    "age": 172
  },
  "room_id": "!MjVdMmsFAxVzHUZLiV:matrix.org"
}
olmari commented 4 years ago

Apparently edit data in m.relates_to is missing a event_id to point what message the edit is for, thus bridge forgets to set that is the original failure, but indeed riotX fails to fallback as well as obviously fail the edit itself (as it isn't possible).