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.
This commit is contained in:
parent
7211dd8fda
commit
60663ed040
1
TODO.md
1
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,
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user