Display RoomMessageImage events

This commit is contained in:
miruka 2019-09-14 00:46:33 -04:00
parent 0db34cc3c8
commit 451038641e
3 changed files with 24 additions and 13 deletions

View File

@ -1,3 +1,10 @@
- Media
- Caching
- Downloading
- Files, links, video, audio
- Encrypted media
- Loading animation
- Refactoring
- Room header elide detection
- Use HBox for Profile
@ -13,6 +20,7 @@
- When qml syntax highlighting supports ES6 string interpolation, use that
- Fixes
- GIF glitchy border
- When selecting text and scrolling up, selection stops working after a while
- Ensure all the text that should be copied is copied

View File

@ -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,
)

View File

@ -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)]