Display RoomMessageImage events
This commit is contained in:
@@ -625,16 +625,19 @@ class MatrixClient(nio.AsyncClient):
|
||||
await self.register_nio_event(
|
||||
room,
|
||||
ev,
|
||||
content = "",
|
||||
inline_content = ev.body,
|
||||
media_url = ev.url,
|
||||
media_title = ev.body,
|
||||
media_width = info.get("w") or 0,
|
||||
media_height = info.get("h") or 0,
|
||||
media_duration = info.get("duration") or 0,
|
||||
media_size = info.get("size") or 0,
|
||||
media_mime = info.get("mimetype") or 0,
|
||||
thumbnail_url = info.get("thumbnail_url") or "",
|
||||
content = "",
|
||||
inline_content = ev.body,
|
||||
media_url = nio.Api.mxc_to_http(ev.url),
|
||||
media_title = ev.body,
|
||||
media_width = info.get("w") or 0,
|
||||
media_height = info.get("h") or 0,
|
||||
media_duration = info.get("duration") or 0,
|
||||
media_size = info.get("size") or 0,
|
||||
media_mime = info.get("mimetype") or 0,
|
||||
|
||||
thumbnail_url =
|
||||
nio.Api.mxc_to_http(info.get("thumbnail_url") or ""),
|
||||
|
||||
thumbnail_width = thumb_info.get("w") or 0,
|
||||
thumbnail_height = thumb_info.get("h") or 0,
|
||||
)
|
||||
|
@@ -162,12 +162,12 @@ class Event(ModelItem):
|
||||
|
||||
@property
|
||||
def links(self) -> List[str]:
|
||||
if not self.content.strip():
|
||||
return []
|
||||
|
||||
if isinstance(self.source, nio.RoomMessageMedia):
|
||||
return [self.media_url]
|
||||
|
||||
if not self.content.strip():
|
||||
return []
|
||||
|
||||
return [link[2] for link in lxml.html.iterlinks(self.content)]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user