Skip to content

Commit 2f9654c

Browse files
committed
Match mautrix-go behavior for reply fallback removal
1 parent 80c5a0f commit 2f9654c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mautrix/types/event/message.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,12 @@ def trim_reply_fallback(self) -> None:
350350
setattr(self, "__reply_fallback_trimmed", True)
351351

352352
def _trim_reply_fallback_text(self) -> None:
353-
if not self.body.startswith("> ") or "\n" not in self.body:
353+
if not self.body.startswith("> <") or "\n" not in self.body:
354354
return
355355
lines = self.body.split("\n")
356356
while len(lines) > 0 and lines[0].startswith("> "):
357357
lines.pop(0)
358-
# Pop extra newline at end of fallback
359-
lines.pop(0)
360-
self.body = "\n".join(lines)
358+
self.body = "\n".join(lines).strip()
361359

362360
def _trim_reply_fallback_html(self) -> None:
363361
if self.formatted_body and self.format == Format.HTML:

0 commit comments

Comments
 (0)