slightly nicer and shorter QR and invite codes (#7390)

- sort garbage to the beginning, readable text to the end
- instead of `%20`, make use of `+` to encode spaces
- shorter invite links and smaller QR codes by truncation of the names

the truncation of the name uses chars() which does not respect grapheme clusters, so
that last character may be wrong. not sure if there is a nice and easy
alternative, but maybe it's good engoug - the real, full name will come
over the wire (exiting truncate() truncates on word boundaries, which is
maybe too soft here - names may be long, depending on the language, and
not contain any space)

moreover, this resolves the "name too long" issue from
https://github.com/chatmail/core/issues/7015

---------

Co-authored-by: Hocuri <hocuri@gmx.de>
This commit is contained in:
bjoern
2025-11-04 22:01:24 +01:00
committed by GitHub
parent 9c2a13b88e
commit ee6b9075aa
5 changed files with 89 additions and 43 deletions

View File

@@ -940,7 +940,7 @@ def test_leave_broadcast(acfactory, all_devices_online):
bob2.start_io()
logging.info("===================== Alice creates a broadcast =====================")
alice_chat = alice.create_broadcast("Broadcast channel for everyone!")
alice_chat = alice.create_broadcast("Broadcast channel!")
logging.info("===================== Bob joins the broadcast =====================")
qr_code = alice_chat.get_qr_code()
@@ -957,8 +957,8 @@ def test_leave_broadcast(acfactory, all_devices_online):
assert member_added_msg.get_snapshot().text == "You joined the channel."
def get_broadcast(ac):
chat = ac.get_chatlist(query="Broadcast channel for everyone!")[0]
assert chat.get_basic_snapshot().name == "Broadcast channel for everyone!"
chat = ac.get_chatlist(query="Broadcast channel!")[0]
assert chat.get_basic_snapshot().name == "Broadcast channel!"
return chat
def check_account(ac, contact, inviter_side, please_wait_info_msg=False):