Trim last newline in the chat encryption info

Android seems to display it, making the message box larger.
This commit is contained in:
link2xt
2022-05-21 17:02:02 +00:00
parent deece15648
commit b7d2828f60
3 changed files with 9 additions and 8 deletions

View File

@@ -5,6 +5,7 @@
### Fixes ### Fixes
- do not unnecessarily SELECT folders if there are no operations planned on - do not unnecessarily SELECT folders if there are no operations planned on
them #3333 them #3333
- trim chat encryption info #3350
## 1.83.0 ## 1.83.0

View File

@@ -689,7 +689,7 @@ def test_gossip_encryption_preference(acfactory, lp):
msg = ac1._evtracker.wait_next_incoming_message() msg = ac1._evtracker.wait_next_incoming_message()
assert msg.text == "first message" assert msg.text == "first message"
assert not msg.is_encrypted() assert not msg.is_encrypted()
res = "End-to-end encryption preferred:\n{}\n".format(ac2.get_config('addr')) res = "End-to-end encryption preferred:\n{}".format(ac2.get_config('addr'))
assert msg.chat.get_encryption_info() == res assert msg.chat.get_encryption_info() == res
lp.sec("ac2 learns that ac3 prefers encryption") lp.sec("ac2 learns that ac3 prefers encryption")
ac2.create_chat(ac3) ac2.create_chat(ac3)
@@ -701,7 +701,7 @@ def test_gossip_encryption_preference(acfactory, lp):
lp.sec("ac3 does not know that ac1 prefers encryption") lp.sec("ac3 does not know that ac1 prefers encryption")
ac1.create_chat(ac3) ac1.create_chat(ac3)
chat = ac3.create_chat(ac1) chat = ac3.create_chat(ac1)
res = "No encryption:\n{}\n".format(ac1.get_config('addr')) res = "No encryption:\n{}".format(ac1.get_config('addr'))
assert chat.get_encryption_info() == res assert chat.get_encryption_info() == res
msg = chat.send_text("not encrypted") msg = chat.send_text("not encrypted")
msg = ac1._evtracker.wait_next_incoming_message() msg = ac1._evtracker.wait_next_incoming_message()
@@ -712,7 +712,7 @@ def test_gossip_encryption_preference(acfactory, lp):
group_chat = ac1.create_group_chat("hello") group_chat = ac1.create_group_chat("hello")
group_chat.add_contact(ac2) group_chat.add_contact(ac2)
encryption_info = group_chat.get_encryption_info() encryption_info = group_chat.get_encryption_info()
res = "End-to-end encryption preferred:\n{}\n".format(ac2.get_config("addr")) res = "End-to-end encryption preferred:\n{}".format(ac2.get_config("addr"))
assert encryption_info == res assert encryption_info == res
msg = group_chat.send_text("hi") msg = group_chat.send_text("hi")

View File

@@ -895,7 +895,7 @@ impl ChatId {
ret += &ret_mutual; ret += &ret_mutual;
} }
Ok(ret) Ok(ret.trim().to_string())
} }
/// Bad evil escape hatch. /// Bad evil escape hatch.
@@ -5429,7 +5429,7 @@ mod tests {
assert_eq!( assert_eq!(
chat_id.get_encryption_info(&alice).await?, chat_id.get_encryption_info(&alice).await?,
"No encryption:\n\ "No encryption:\n\
bob@example.net\n" bob@example.net"
); );
add_contact_to_chat(&alice, chat_id, contact_fiona).await?; add_contact_to_chat(&alice, chat_id, contact_fiona).await?;
@@ -5437,7 +5437,7 @@ mod tests {
chat_id.get_encryption_info(&alice).await?, chat_id.get_encryption_info(&alice).await?,
"No encryption:\n\ "No encryption:\n\
bob@example.net\n\ bob@example.net\n\
fiona@example.net\n" fiona@example.net"
); );
let direct_chat = bob.create_chat(&alice).await; let direct_chat = bob.create_chat(&alice).await;
@@ -5450,7 +5450,7 @@ mod tests {
fiona@example.net\n\ fiona@example.net\n\
\n\ \n\
End-to-end encryption preferred:\n\ End-to-end encryption preferred:\n\
bob@example.net\n" bob@example.net"
); );
bob.set_config(Config::E2eeEnabled, Some("0")).await?; bob.set_config(Config::E2eeEnabled, Some("0")).await?;
@@ -5463,7 +5463,7 @@ mod tests {
fiona@example.net\n\ fiona@example.net\n\
\n\ \n\
End-to-end encryption available:\n\ End-to-end encryption available:\n\
bob@example.net\n" bob@example.net"
); );
Ok(()) Ok(())