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

Replying with an image does not show the image #8432

Open
Polsaker opened this issue May 13, 2023 · 5 comments
Open

Replying with an image does not show the image #8432

Polsaker opened this issue May 13, 2023 · 5 comments
Labels
A-Media O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems

Comments

@Polsaker
Copy link

Steps to reproduce

  1. Where are you starting? What can you see?
    When I reply to a message with an image, the image does not appear

  2. What do you click?
    On desktop, I reply to a message and send an image

Outcome

What did you expect?

I expect the reply card AND the image to appear

What happened instead?

Only the reply card appears and the image is not shown.

Below is the comparison of element web vs android:

image

image

Your phone model

Samsung S21

Operating system version

Android 12

Application version and app store

Element 1.5.32 from play store

Homeserver

No response

Will you send logs?

No

Are you willing to provide a PR?

No

@Polsaker Polsaker added the T-Defect Something isn't working: bugs, crashes, hangs and other reported problems label May 13, 2023
@jonnyandrew jonnyandrew added A-Media S-Major Severely degrades major functionality or product features, with no satisfactory workaround O-Occasional Affects or can be seen by some users regularly or most users rarely labels May 15, 2023
@rom4nik
Copy link
Contributor

rom4nik commented May 17, 2023

I think this could be related to missing reply fallbacks - I'm using a Telegram bridge, whose admin disabled reply fallbacks (mautrix/telegram@c4037cc) today, which caused new replies (with any kind of content) from Telegram to appear like this:

Screenshot_20230517-225424_Element

In each reply only the original message is visible (pixelized on screenshot), the text of the reply is blank. I can see the reply text in long press menu and in "view source". Here's a source of one of such replies:

{
  "content": {
    "body": "(redacted - only the actual reply text, no contents of original message)",
    "external_url": "https://t.me/c/(redacted)/(redacted)",
    "fi.mau.telegram.source": {
      "chat_id": (redacted),
      "id": (redacted),
      "peer_type": "channel",
      "space": (redacted)
    },
    "m.relates_to": {
      "m.in_reply_to": {
        "event_id": "(redacted)"
      }
    },
    "msgtype": "m.text"
  },
  "origin_server_ts": 1684355648000,
  "room_id": "(redacted)",
  "sender": "(redacted sender MXID)",
  "type": "m.room.message",
  "unsigned": {},
  "event_id": "(redacted)",
  "user_id": "(redacted)"
}

Before today, while reply fallbacks were still enabled on this bridge instance, I had a similar issue where images/videos sent from Telegram as replies to another message would appear empty in timeline, but appear in context menu. I think I've been experiencing that particular issue for a few months (occurs in 1.6.0 as well). Visually it looks the same, but the message source was a bit different:

{
  "content": {
    "body": "image.jpeg",
    "external_url": "https://t.me/c/(redacted)/(redacted)",
    "fi.mau.telegram.source": {
      "chat_id": (redacted),
      "id": (redacted),
      "peer_type": "channel",
      "space": (redacted)
    },
    "info": {
      "h": 1280,
      "mimetype": "image/jpeg",
      "orientation": 0,
      "size": 83241,
      "w": 591
    },
    "m.relates_to": {
      "m.in_reply_to": {
        "event_id": "(redacted)"
      }
    },
    "msgtype": "m.image",
    "url": "mxc://(redacted)"
  },
  "origin_server_ts": 1683817668000,
  "room_id": "(redacted)",
  "sender": "(redacted)",
  "type": "m.room.message",
  "unsigned": {},
  "event_id": "(redacted)",
  "user_id": "(redacted)"
}

I've observed both cases of this problem only on Element Android - web/desktop Element and Nheko render both kinds of replies correctly.

@rom4nik
Copy link
Contributor

rom4nik commented May 17, 2023

Steps to reproduce my issue (any replies, including plaintext) using Element Web in a regular room, without Telegram bridge:

  1. Send a message
  2. Press reply on message from step 1
  3. Type a reply, send
  4. View source of message from step 3
  5. Copy content
  6. Room menu -> dev tools -> send custom timeline event
  7. Set type to m.room.message, paste content from step 5
  8. Remove formatted_body key and the original message from value of body, send
  9. Observe results

Element Web 1.11.31:
image

Element Android 1.6.0 (present on older versions as well):
Screenshot_20230517-234433_Element

content of message sent using reply button:

  "content": {
    "msgtype": "m.text",
    "body": "> <@przemek:rom4nik.pl> first\n\nsecond (element web reply button)",
    "format": "org.matrix.custom.html",
    "formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!KNgzYqqOpKspiUPekp:rom4nik.pl/$rVpCqPgMj6mDB1azxfRmi_9Srida_lXzaY3ttgWYAxQ?via=rom4nik.pl\">In reply to</a> <a href=\"https://matrix.to/#/@przemek:rom4nik.pl\">@przemek:rom4nik.pl</a><br>first</blockquote></mx-reply>second (element web reply button)",
    "m.relates_to": {
      "m.in_reply_to": {
        "event_id": "$rVpCqPgMj6mDB1azxfRmi_9Srida_lXzaY3ttgWYAxQ"
      }
    }
  },

content of message sent via dev tools with fallback removed:

  "content": {
    "msgtype": "m.text",
    "body": "second (element web devtools with no fallback)",
    "format": "org.matrix.custom.html",
    "m.relates_to": {
      "m.in_reply_to": {
        "event_id": "$rVpCqPgMj6mDB1azxfRmi_9Srida_lXzaY3ttgWYAxQ"
      }
    }
  },

There's a chance that the reply will have visible reply text, but will be lacking original message's text. Going to room list and back to the room usually makes the message appear as in screenshots above (only original message's text, no reply text).

@K4LCIFER
Copy link

K4LCIFER commented Aug 2, 2023

I have the same issue. I can see the image in the reply on element-desktop, but I am unable to see images in replies on element-android.

@yelsane
Copy link

yelsane commented Dec 11, 2023

Experiencing the same issue. However, it doesn't seem to be exclusive to just images.

For context, we use a custom field (i.e. we don't use the Matrix approach) to include attachments in the event: e.g.

{
  "content": {
    ...
    "attachments" : [ // custom attachment field
      {
        <attachment data>
      } 
    ],
    ...
  }
}

Which works fine, is sent properly -- verified by fetching the details thru the REST API via Postman and received as expected.
The issue seems to be somewhere in the SDK (?) where it receives replies. The timeline event received from onTimelineUpdated() that are replies do not show any custom fields.

So sending a reply event with a custom field (e.g. above should be root.content.attachments) won't show in the parsed timeline event.

Assumed that there might have been an update in the SDK that caused this, we tried downgrading to version 1.5.22, since we were able to test this use-case, but the problem persisted.

Checking our old project against our current project, the next thing that we tried looking into is an update in the server version. Old project was using v1.2 while the new one is v1.8. Which brings me to the note mentioned in Sending events to a room:

[Added in v1.3]

Servers might need to post-process some events if they relate to another event. The event’s relationship type (rel_type) determines any restrictions which might apply, such as the user only being able to send one event of a given type in relation to another.

But then again, how is an older version of the SDK impacted when parsing reply timeline events? Tried going through the code to figure out where it is filtering reply timeline events but haven't had much luck.

@britiger
Copy link

britiger commented Apr 4, 2024

I've same issue in groups bridged by signal mautrix. I can't read replied messages and images. A workaround for me is a long press for more interactions on the message then I can see the text or images in the popup menu. On Element-Desktop I works without problems
Android 13 on Pixel 4a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Media O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Something isn't working: bugs, crashes, hangs and other reported problems
Projects
None yet
Development

No branches or pull requests

6 participants