Fix room subtitle for local echoes
This commit is contained in:
parent
f8a392883b
commit
4ff3ebe255
|
@ -170,10 +170,12 @@ class MatrixClient(nio.AsyncClient):
|
||||||
text = text[1:]
|
text = text[1:]
|
||||||
|
|
||||||
if text.startswith("/me ") and not escape:
|
if text.startswith("/me ") and not escape:
|
||||||
|
event_type = nio.RoomMessageEmote.__name__
|
||||||
text = text[len("/me "): ]
|
text = text[len("/me "): ]
|
||||||
content = {"body": text, "msgtype": "m.emote"}
|
content = {"body": text, "msgtype": "m.emote"}
|
||||||
to_html = HTML_FILTER.from_markdown_inline(text, outgoing=True)
|
to_html = HTML_FILTER.from_markdown_inline(text, outgoing=True)
|
||||||
else:
|
else:
|
||||||
|
event_type = nio.RoomMessageText.__name__
|
||||||
content = {"body": text, "msgtype": "m.text"}
|
content = {"body": text, "msgtype": "m.text"}
|
||||||
to_html = HTML_FILTER.from_markdown(text, outgoing=True)
|
to_html = HTML_FILTER.from_markdown(text, outgoing=True)
|
||||||
|
|
||||||
|
@ -188,13 +190,14 @@ class MatrixClient(nio.AsyncClient):
|
||||||
display_content = content.get("formatted_body") or content["body"]
|
display_content = content.get("formatted_body") or content["body"]
|
||||||
|
|
||||||
local = Event(
|
local = Event(
|
||||||
source = None,
|
source = None,
|
||||||
client_id = f"echo-{uuid}",
|
client_id = f"echo-{uuid}",
|
||||||
event_id = "",
|
event_id = "",
|
||||||
date = datetime.now(),
|
date = datetime.now(),
|
||||||
content = display_content,
|
content = display_content,
|
||||||
inline_content = HTML_FILTER.filter_inline(display_content),
|
inline_content = HTML_FILTER.filter_inline(display_content),
|
||||||
is_local_echo = True,
|
is_local_echo = True,
|
||||||
|
local_event_type = event_type,
|
||||||
|
|
||||||
sender_id = self.user_id,
|
sender_id = self.user_id,
|
||||||
sender_name = our_info.display_name,
|
sender_name = our_info.display_name,
|
||||||
|
|
|
@ -124,7 +124,8 @@ class Event(ModelItem):
|
||||||
target_name: str = ""
|
target_name: str = ""
|
||||||
target_avatar: str = ""
|
target_avatar: str = ""
|
||||||
|
|
||||||
is_local_echo: bool = False
|
is_local_echo: bool = False
|
||||||
|
local_event_type: str = ""
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
self.inline_content = HTML_FILTER.filter_inline(self.content)
|
self.inline_content = HTML_FILTER.filter_inline(self.content)
|
||||||
|
@ -142,7 +143,7 @@ class Event(ModelItem):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def event_type(self) -> str:
|
def event_type(self) -> str:
|
||||||
return type(self.source).__name__
|
return self.local_event_type or type(self.source).__name__
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|
|
@ -61,6 +61,7 @@ function processedEventText(ev) {
|
||||||
)
|
)
|
||||||
|
|
||||||
if (text.includes("%2") && ev.target_id) {
|
if (text.includes("%2") && ev.target_id) {
|
||||||
|
print(2)
|
||||||
text = text.arg(coloredNameHtml(ev.target_name, ev.target_id))
|
text = text.arg(coloredNameHtml(ev.target_name, ev.target_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user