No need for origin_*body Event keys
Also fixes lack of original message text when replying to non-message events.
This commit is contained in:
parent
b09b3b990b
commit
66f9a17111
|
@ -426,15 +426,19 @@ class MatrixClient(nio.AsyncClient):
|
|||
to: Event = \
|
||||
self.models[self.user_id, room_id, "events"][reply_to_event_id]
|
||||
|
||||
source_body = getattr(to.source, "body", "")
|
||||
|
||||
content["format"] = "org.matrix.custom.html"
|
||||
content["body"] = f"> <{to.sender_id}> {to.origin_body}"
|
||||
content["body"] = f"> <{to.sender_id}> {source_body}"
|
||||
|
||||
to_html = REPLY_FALLBACK.format(
|
||||
room_id = room_id,
|
||||
event_id = reply_to_event_id,
|
||||
user_id = to.sender_id,
|
||||
content =
|
||||
to.origin_formatted_body or html.escape(to.origin_body),
|
||||
getattr(to.source, "formatted_body", "") or
|
||||
source_body or
|
||||
html.escape(to.source.source["type"] if to.source else ""),
|
||||
|
||||
reply_content = to_html,
|
||||
)
|
||||
|
@ -459,8 +463,6 @@ class MatrixClient(nio.AsyncClient):
|
|||
event_type,
|
||||
content = echo_body,
|
||||
mentions = mentions,
|
||||
origin_body = content["body"],
|
||||
origin_formatted_body = content.get("formatted_body") or "",
|
||||
)
|
||||
|
||||
await self._send_message(room_id, content, tx_id)
|
||||
|
@ -697,7 +699,6 @@ class MatrixClient(nio.AsyncClient):
|
|||
transaction_id,
|
||||
event_type,
|
||||
inline_content = content["body"],
|
||||
origin_body = content["body"],
|
||||
media_url = url,
|
||||
media_title = path.name,
|
||||
media_width = content["info"].get("w", 0),
|
||||
|
@ -1437,9 +1438,6 @@ class MatrixClient(nio.AsyncClient):
|
|||
target_avatar = target_avatar,
|
||||
links = Event.parse_links(content),
|
||||
|
||||
origin_body = getattr(ev, "body", "") or "",
|
||||
origin_formatted_body = getattr(ev, "formatted_body", "") or "",
|
||||
|
||||
fetch_profile =
|
||||
(must_fetch_sender or must_fetch_target)
|
||||
if override_fetch_profile is None else
|
||||
|
|
|
@ -219,8 +219,6 @@ class Event(ModelItem):
|
|||
sender_avatar: str = field()
|
||||
fetch_profile: bool = False
|
||||
|
||||
origin_body: str = ""
|
||||
origin_formatted_body: str = ""
|
||||
content: str = ""
|
||||
inline_content: str = ""
|
||||
reason: str = ""
|
||||
|
|
Loading…
Reference in New Issue
Block a user