Skip to content

fix: Update the channel title after joining if the QR code included a wrong title#8260

Open
Hocuri wants to merge 4 commits into
mainfrom
hoc/removing-update-chatname
Open

fix: Update the channel title after joining if the QR code included a wrong title#8260
Hocuri wants to merge 4 commits into
mainfrom
hoc/removing-update-chatname

Conversation

@Hocuri
Copy link
Copy Markdown
Collaborator

@Hocuri Hocuri commented May 20, 2026

Fix #8250. Not sure why anyone would tamper with the link, but maybe the name gets ellipsized because it is very long, or maybe we decide to ellipsize more aggressively in the future.

The fix is easy enough, just set the GroupNameTimestamp when creating the channel, so that HeaderDef::ChatGroupNameTimestamp gets set when sending a message and the logic in apply_chat_name_avatar_and_description_changes() recognizes the incoming name's timestamp as newer than chat_group_name_timestamp (which is 0 right after joining a chat).

The test is somewhat hacky and depends on the title being the last parameter in the invite code URL, but this is fine; if we ever change that, then the test will fail and we need to modify it.

Comment thread src/chat.rs
)?;
ensure!(cnt == 0, "{cnt} chats exist with grpid {grpid}");
let mut params: Params = Params::new();
params.update_timestamp(Param::GroupNameTimestamp, time())?;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear why this is needed for broadcasts, but not for groups. Why doesn't .set_i64(Param::GroupNameTimestamp, msg.timestamp_sort) in prepare_msg_raw() work, because prepare_msg_raw() isn't called when adding a new subscriber?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of && self.param.get_int(Param::Unpromoted).unwrap_or_default() == 1. Groups are unpromoted right after creating them, broadcast channels are immediately promoted.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the check in prepare_msg_raw() should be fixed, checking for Chattype::OutBroadcast is not necessary and confusing. And the documentation of create_broadcast() says:

/// After creation, the chat contains no recipients and is in _unpromoted_ state;

Should be fixed as well.

But the reason why for groups Param::GroupNameTimestamp is set when they get promoted is to not reveal the group creation time, as far as i remember. For broadcasts it also may make sense. Would be good to have the same logic for groups and broadcasts, maybe just set the timestamp to 1 on chat creation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Channel name from an invite link's b= parameter is never reconciled with the channel's actual name

2 participants