mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
Only use summary for quote if text is empty
For text messages, summary joins all lines into one, so multi-line quotes look bad in Thunderbird.
This commit is contained in:
committed by
link2xt
parent
bb50b9abe4
commit
69f159792e
@@ -479,7 +479,7 @@ class TestOfflineChat:
|
|||||||
def test_quote(self, chat1):
|
def test_quote(self, chat1):
|
||||||
"""Offline quoting test"""
|
"""Offline quoting test"""
|
||||||
msg = Message.new_empty(chat1.account, "text")
|
msg = Message.new_empty(chat1.account, "text")
|
||||||
msg.set_text("message")
|
msg.set_text("Multi\nline\nmessage")
|
||||||
assert msg.quoted_text is None
|
assert msg.quoted_text is None
|
||||||
|
|
||||||
# Prepare message to assign it a Message-Id.
|
# Prepare message to assign it a Message-Id.
|
||||||
@@ -489,7 +489,7 @@ class TestOfflineChat:
|
|||||||
reply_msg = Message.new_empty(chat1.account, "text")
|
reply_msg = Message.new_empty(chat1.account, "text")
|
||||||
reply_msg.set_text("reply")
|
reply_msg.set_text("reply")
|
||||||
reply_msg.quote = msg
|
reply_msg.quote = msg
|
||||||
assert reply_msg.quoted_text == "message"
|
assert reply_msg.quoted_text == "Multi\nline\nmessage"
|
||||||
|
|
||||||
def test_group_chat_many_members_add_remove(self, ac1, lp):
|
def test_group_chat_many_members_add_remove(self, ac1, lp):
|
||||||
lp.sec("ac1: creating group chat with 10 other members")
|
lp.sec("ac1: creating group chat with 10 other members")
|
||||||
|
|||||||
@@ -764,8 +764,16 @@ impl Message {
|
|||||||
self.param.set(Param::GuaranteeE2ee, "1");
|
self.param.set(Param::GuaranteeE2ee, "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
self.param
|
let text = quote.get_text().unwrap_or_default();
|
||||||
.set(Param::Quote, quote.get_summarytext(context, 500).await);
|
self.param.set(
|
||||||
|
Param::Quote,
|
||||||
|
if text.is_empty() {
|
||||||
|
// Use summary, similar to "Image" to avoid sending empty quote.
|
||||||
|
quote.get_summarytext(context, 500).await
|
||||||
|
} else {
|
||||||
|
text
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user