Fix displaying local echo html formatting

This commit is contained in:
miruka 2019-08-30 11:53:55 -04:00
parent aec83c66f3
commit 720eb78fe8
2 changed files with 6 additions and 5 deletions

View File

@ -12,7 +12,6 @@
- Fixes
- Icons on KDE
- Greentext for local echo
- Show error if uploading avatar fails

View File

@ -174,10 +174,12 @@ class MatrixClient(nio.AsyncClient):
text = text[len("/me "): ]
content = {"body": text, "msgtype": "m.emote"}
to_html = HTML_FILTER.from_markdown_inline(text, outgoing=True)
echo_body = HTML_FILTER.from_markdown_inline(text)
else:
event_type = nio.RoomMessageText.__name__
content = {"body": text, "msgtype": "m.text"}
to_html = HTML_FILTER.from_markdown(text, outgoing=True)
echo_body = HTML_FILTER.from_markdown(text)
if to_html not in (html.escape(text), f"<p>{html.escape(text)}</p>"):
content["format"] = "org.matrix.custom.html"
@ -187,15 +189,15 @@ class MatrixClient(nio.AsyncClient):
self.local_echoes_uuid.add(uuid)
our_info = self.models[Member, room_id][self.user_id]
display_content = content.get("formatted_body") or content["body"]
import remote_pdb; remote_pdb.RemotePdb("127.0.0.1", 4444).set_trace()
local = Event(
source = None,
client_id = f"echo-{uuid}",
event_id = "",
date = datetime.now(),
content = display_content,
inline_content = HTML_FILTER.filter_inline(display_content),
content = echo_body,
inline_content = HTML_FILTER.filter_inline(echo_body),
is_local_echo = True,
local_event_type = event_type,