From 60663ed040d201c9920dafcd8eb6548e6cebc0d7 Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 10 Sep 2019 22:05:06 -0400 Subject: [PATCH] Leave non-image links out from Event.previe_links normal links preview isn't implemented yet, which caused any message with a link to take at least 256px due to the preview repeater. --- TODO.md | 1 - src/python/models/items.py | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index d9c4291f..f50718e2 100644 --- a/TODO.md +++ b/TODO.md @@ -13,7 +13,6 @@ - When qml syntax highlighting supports ES6 string interpolation, use that - Fixes - - 256 min width when a non-image link preview is present - Pressing backspace in composer sometimes doesn't work - Message order isn't preserved when sending a first message in a E2E room, then while keys are being shared sending one with another account, diff --git a/src/python/models/items.py b/src/python/models/items.py index 7eedef4a..5a7cc141 100644 --- a/src/python/models/items.py +++ b/src/python/models/items.py @@ -153,11 +153,13 @@ class Event(ModelItem): if not self.content.strip(): return [] - return [ + links = [ (self._get_preview_type(link[0], link[2]), link[2]) for link in lxml.html.iterlinks(self.content) ] + return [l for l in links if l[0] != "page"] # TODO + @staticmethod def _get_preview_type(el: lxml.html.HtmlElement, link: str) -> str: path = urlparse(link).path.lower()