morethanwords/tweb/master • d2040a0 • 16 files, +636/-120
Give Community chats the context menu every other dialog gets
A chat row inside a Community panel had almost no context menu: the menu kept a
whitelist, and an item was shown there only if it carried a `communityMode`,
which left Mute/Unmute and Remove from Community and nothing else. But such a
row IS a dialog row — the whitelist is backwards. It is an opt-OUT now: the row
gets the standard items, and only what makes no sense there is dropped.
Add to Folder, Pin/Unpin and Archive act on the chat's place in OUR chat list,
so they are offered only while the Community isn't folded into a single row —
folded, those chats have no place of their own to act on. Everything else is
left to its own verify, which already reduces to what a given row can do: a
chat we only watch has no dialog, so nothing that acts on one survives.
The "chats you can request to join" and "hidden chats" sections had no menu at
all — they are drawn by CommunityPeerDialogList, which never passed
`withContext` to setListClickListener, and their rows carried none of the
dataset the menu reads. Both are wired now, so an admin can unlink a chat from
there too; the rest is verified away, since we can neither open nor read those
chats. Preview is the one item that had to learn the difference: it now also
shows for a `viewable` chat, which has no dialog but does have history in the
row (shift+click already previewed it), and stays hidden for the two kinds we
have no access to.
Remove from Community wore the trash icon, the same one as the Delete item
right below it. It unlinks a chat rather than deleting it, so it takes the
cross — as it does on Android, and as "remove from album" / "remove ads" do
here. Both places that offer the action also had a full copy of the same
confirm-then-unlink flow; they share one now.
Mute on the Community row never appeared, however the Community was set up:
`!managers.appCommunitiesManager.isCommunityMuted(id)` negates a Promise, which
is always false. Unmute worked because it returned the promise instead of
negating it — hence "there is an Unmute but never a Mute". It awaits now.
Muting a whole Community was also reachable from that row alone, i.e. only
while "Show as One Chat" was on. The Community panel's menu offers it too now.
Its popup was a stray as well: PopupPeer draws its avatar from `peerId`, and a
Community can't go through that path (its avatar is the decorated one), so the
popup was passed no peer at all and showed a bare title where every other mute
popup shows an avatar. PopupPeer takes an avatar element now, and the popup
builds the same Community avatar the chat list uses.
Unrelated, from the same panel: the header title and subtitle each held a
wrapper div, because `<Portal mount>` always creates its own container. Both
carry `text-overflow: ellipsis`, which a block child defeats — a long Community
name ran past the header instead of ellipsizing. They mount through a small
InlinePortal helper now, which inserts the children directly into the host.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
#webk
Post #20532
155
- 🫡 3