+
Skip to content

feat: Show broadcast channels in their own, proper "Channel" chat #6901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jul 2, 2025

Conversation

Hocuri
Copy link
Collaborator

@Hocuri Hocuri commented Jun 4, 2025

Part of #6884


  • Add new chat type InBroadcastChannel and OutBroadcastChannel for incoming / outgoing channels, where the former is similar to a Mailinglist and the latter is similar to a Broadcast (which is removed)
    • Consideration for naming: InChannel/OutChannel (without "broadcast") would be shorter, but less greppable because we already have a lot of occurences of channel in the code. Consistently calling them BcChannel/bc_channel in the code would be both short and greppable, but a bit arcane when reading it at first. Opinions are welcome; if I hear none, I'll keep with BroadcastChannel.
  • api: Add create_broadcast_channel(), deprecate create_broadcast_list() (or create_channel() / create_bc_channel() if we decide to switch)
    • Adjust code comments to match the new behavior.
  • Ask Desktop developers what they use is_broadcast field for, and whether it should be true for both outgoing & incoming channels (or look it up myself)
    • I added is_out_broadcast_channel, and deprecated is_broadcast, for now
  • When the user changes the broadcast channel name, immediately show this change on receiving devices
  • Allow to change brodacast channel avatar, and immediately apply it on the receiving device
  • Make it possible to block InBroadcastChannel
  • Make it possible to set the avatar of an OutgoingChannel, and apply it on the receiving side
  • DECIDE whether we still want to use the broadcast icon as the default icon or whether we want to use the letter-in-a-circle
    • We decided to use the letter-in-a-circle for now, because it's easier to implement, and I need to stay in the time plan
  • chat.rs: Return an error if the user tries to modify a InBroadcastChannel
  • Add automated regression tests
  • Grep for broadcast and see whether there is any other work I need to do
  • Bug: Don't show ~ in front of the sender's same in broadcast lists

Note that I removed the following guard:

        if !new_chat_contacts.contains(&ContactId::SELF) {
            warn!(
                context,
                "Received group avatar update for group chat {} we are not a member of.", chat.id
            );
        } else if !new_chat_contacts.contains(&from_id) {
            warn!(
                context,
                "Contact {from_id} attempts to modify group chat {} avatar without being a member.",
                chat.id,
            );
        } else [...]

i.e. with this change, non-members will be able to modify the avatar. Things were slightly easier this way, and I think that this is in line with non-members being able to modify the group name and memberlist (they need to know the Group-Chat-Id, anyway), but I can also change it back.

@Hocuri Hocuri changed the base branch from main to link2xt/pgp-contacts June 4, 2025 13:33
@Hocuri Hocuri changed the title [WIP] Show channels in their own chat [WIP] Show broadcast channels in their own, proper "Channel" chat Jun 15, 2025
@Hocuri Hocuri force-pushed the hoc/channels branch 2 times, most recently from 48fd8ec to 12bb5aa Compare June 23, 2025 13:42
@Hocuri Hocuri changed the title [WIP] Show broadcast channels in their own, proper "Channel" chat Show broadcast channels in their own, proper "Channel" chat Jun 23, 2025
@Hocuri Hocuri requested review from link2xt and iequidoo June 23, 2025 13:44
@iequidoo
Copy link
Collaborator

iequidoo commented Jun 24, 2025

  • Consistently calling them BcChannel/bc_channel in the code would be both short and greppable, but a bit arcane when reading it at first. Opinions are welcome; if I hear none, I'll keep with BroadcastChannel.

My preference would be {In,Out}Broadcast because Broadcast is removed anyway, so those names won't conflict with it. But if ...Channel is necessary, then i'd go for {In,Out}BcChannel or even {In,Out}Bchannel because {In,Out}BroadcastChannel is really long and causes line wrapping and more scrolling for readers.

  • Make it possible to set the avatar of an OutgoingChannel, and apply it on the receiving side

Just in case, duplicated entry in the description.

  • When the user changes the broadcast channel name, immediately show this change on receiving devices

Maybe also allow renaming incoming broadcasts like it's done for mailing lists? It would cost two LOCs (and probably no additional UI work). While renaming broadcasts may not be possible in other messengers, it may help users to origanize and search broadcasts. EDIT: Then we need to resolve name conflicts if a broadcast is renamed by the sender. Let's skip renaming incoming broadcast for now at least.

Base automatically changed from link2xt/pgp-contacts to main June 26, 2025 14:06
@link2xt link2xt force-pushed the main branch 2 times, most recently from 285d80a to 416131b Compare June 26, 2025 14:07
@adbenitez
Copy link
Collaborator

I want to merge this only after #6796 is merged, but until then, this can already be reviewed

that one got already merged! 🎉

@Hocuri
Copy link
Collaborator Author

Hocuri commented Jun 30, 2025

@link2xt was also in favor of {In|Out}Broadcast, so, I renamed them.

@Hocuri Hocuri changed the title Show broadcast channels in their own, proper "Channel" chat feat: Show broadcast channels in their own, proper "Channel" chat Jun 30, 2025
@Hocuri Hocuri force-pushed the hoc/channels branch 2 times, most recently from 634086f to 8cd4130 Compare July 1, 2025 19:57
@Hocuri Hocuri requested review from link2xt and iequidoo July 1, 2025 21:22
assert not bob_chat_snapshot.is_unpromoted
assert bob_chat_snapshot.is_encrypted
assert bob_chat_snapshot.chat_type == ChatType.IN_BROADCAST

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it be checked that the broadcast chat is in a "Request" state and can be unblocked by Bob?

@iequidoo
Copy link
Collaborator

iequidoo commented Jul 2, 2025

i.e. with this change, non-members will be able to modify the avatar. Things were slightly easier this way, and I think that this is in line with non-members being able to modify the group name and memberlist (they need to know the Group-Chat-Id, anyway), but I can also change it back.

Missed this. I think it's a bug that non-members can modify the group name, at least i'd forbid that and see which tests fail. EDIT: At least removed members know Group-Chat-Id, but they mustn't be able to modify the chat.

@Hocuri
Copy link
Collaborator Author

Hocuri commented Jul 2, 2025

Allowing non-members to modify the group is a deliberate trade-off, in order to be more resilient against message reordering: If a group member modifies the group, and is added to the group only afterwards (because the member-addition message arrived late), then it's nice if this group-edit is applied. IIRC, non-members can even modify the memberlist, and add themselves. DC is meant to be a private messenger, rather than one to chat with untrusted people (e.g. there are no group admins), so, being resilient against message reordering was considered more important than protecting against a removed contact editing your group.

But discussing about this is out of scope for this PR.

@Hocuri Hocuri enabled auto-merge (squash) July 2, 2025 20:31
@Hocuri Hocuri merged commit 0a73c2b into main Jul 2, 2025
29 checks passed
@Hocuri Hocuri deleted the hoc/channels branch July 2, 2025 20:40
Hocuri added a commit that referenced this pull request Jul 3, 2025
…te_broadcast_channel()

In #6901, I unfortunately forgot to
document the API change when rebasing.

The API change is breaking because not adapting to the new channel types
would lead to errors.
Hocuri added a commit that referenced this pull request Jul 3, 2025
…te_broadcast_channel()

In #6901, I unfortunately forgot to
document the API change when squash-merging.

The API change is breaking because not adapting to the new channel types
would lead to errors.
Hocuri added a commit that referenced this pull request Jul 3, 2025
Older versions of Delta Chat will ignore the message if it contains a
ChatGroupId header. ("older versions" means all versions without #6901,
i.e.currently released versions)
Hocuri added a commit that referenced this pull request Jul 7, 2025
…te_broadcast_channel() (#6901)

In #6901, I unfortunately forgot to
document the API change when squash-merging, so, I'm doing this with the
PR here.

The API change is breaking because not adapting to the new channel types
would lead to errors.
Hocuri added a commit that referenced this pull request Jul 7, 2025
Older versions of Delta Chat ignore the message if it contains a
ChatGroupId header. ("older versions" means all versions without #6901,
i.e.currently released versions)

This means that without this PR, broadcast channel messages sent from
current main don't arrive at a device running latest released DC.

Part of #6884.
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.

4 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载