Fix room subtitle for local echoes

This commit is contained in:
miruka 2019-08-28 13:29:49 -04:00
parent f8a392883b
commit 4ff3ebe255
3 changed files with 14 additions and 9 deletions

View File

@ -170,10 +170,12 @@ class MatrixClient(nio.AsyncClient):
text = text[1:]
if text.startswith("/me ") and not escape:
event_type = nio.RoomMessageEmote.__name__
text = text[len("/me "): ]
content = {"body": text, "msgtype": "m.emote"}
to_html = HTML_FILTER.from_markdown_inline(text, outgoing=True)
else:
event_type = nio.RoomMessageText.__name__
content = {"body": text, "msgtype": "m.text"}
to_html = HTML_FILTER.from_markdown(text, outgoing=True)
@ -195,6 +197,7 @@ class MatrixClient(nio.AsyncClient):
content = display_content,
inline_content = HTML_FILTER.filter_inline(display_content),
is_local_echo = True,
local_event_type = event_type,
sender_id = self.user_id,
sender_name = our_info.display_name,

View File

@ -125,6 +125,7 @@ class Event(ModelItem):
target_avatar: str = ""
is_local_echo: bool = False
local_event_type: str = ""
def __post_init__(self) -> None:
self.inline_content = HTML_FILTER.filter_inline(self.content)
@ -142,7 +143,7 @@ class Event(ModelItem):
@property
def event_type(self) -> str:
return type(self.source).__name__
return self.local_event_type or type(self.source).__name__
@dataclass

View File

@ -61,6 +61,7 @@ function processedEventText(ev) {
)
if (text.includes("%2") && ev.target_id) {
print(2)
text = text.arg(coloredNameHtml(ev.target_name, ev.target_id))
}