From f6703050738deef67c46b75b7c5acd09b4decf5d Mon Sep 17 00:00:00 2001 From: benya Date: Sun, 8 Mar 2026 14:05:10 +0300 Subject: [PATCH] p0: hide invalid delete action for channel members --- docs/core-checklist-status.md | 6 ++--- web/src/components/MessageList.tsx | 35 +++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/docs/core-checklist-status.md b/docs/core-checklist-status.md index 3957373..3fefa8b 100644 --- a/docs/core-checklist-status.md +++ b/docs/core-checklist-status.md @@ -20,7 +20,7 @@ Legend: 11. Forwarding - `PARTIAL` (single + bulk; "without author" missing) 12. Pinning - `DONE` (message/chat pin-unpin) 13. Reactions - `DONE` -14. Delivery Status - `DONE` (sent/delivered/read) +14. Delivery Status - `DONE` (sent/delivered/read + reconnect reconciliation after backend restarts) 15. Typing Realtime - `PARTIAL` (typing start/stop done; voice/video typing signals limited) 16. Media & Attachments - `DONE` (upload/preview/download/gallery) 17. Voice Messages - `PARTIAL` (record/send/play/seek/speed; UX still being polished) @@ -38,9 +38,9 @@ Legend: 29. Archive - `DONE` 30. Blacklist - `DONE` 31. Privacy - `PARTIAL` (PM permission + block; full matrix controls still limited) -32. Security - `PARTIAL` (sessions + revoke + 2FA base; UX/TOTP flow ongoing) +32. Security - `PARTIAL` (sessions + revoke + 2FA base; revoke-all now invalidates active access tokens, UX/TOTP flow ongoing) 33. Realtime Events - `DONE` (connect/disconnect/send/receive/typing/read/delivered/online/offline + chat/message updates) -34. Sync - `PARTIAL` (cross-device via backend state + realtime; offline reconciliation basic) +34. Sync - `PARTIAL` (cross-device via backend state + realtime; reconciliation improved for loaded chats/messages) 35. Additional - `PARTIAL` (drafts/link preview partial/autoload media basic) ## Current Focus to reach ~80% diff --git a/web/src/components/MessageList.tsx b/web/src/components/MessageList.tsx index 8cb6f59..a17fefd 100644 --- a/web/src/components/MessageList.tsx +++ b/web/src/components/MessageList.tsx @@ -132,6 +132,19 @@ export function MessageList() { () => selectedMessages.length > 0 && selectedMessages.every((m) => canDeleteForEveryone(m, activeChat, me?.id)), [selectedMessages, activeChat, me?.id] ); + const canDeleteCurrentContextMessage = useMemo(() => { + if (!ctx) { + return false; + } + const message = messagesMap.get(ctx.messageId); + if (!message) { + return false; + } + if (channelOnlyDeleteForAll) { + return canDeleteForEveryone(message, activeChat, me?.id); + } + return true; + }, [ctx, messagesMap, channelOnlyDeleteForAll, activeChat, me?.id]); useEffect(() => { const onKeyDown = (event: KeyboardEvent) => { @@ -684,16 +697,18 @@ export function MessageList() { > Select - + {canDeleteCurrentContextMessage ? ( + + ) : null}