feat(web): add role-based channel actions in chat info
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
@@ -32,7 +32,7 @@ Legend:
|
|||||||
23. Groups - `PARTIAL` (create/add/remove/invite link; join-by-invite and invite permissions covered by integration tests; members API now returns profile fields (`username/name/avatar_url`) and web Chat Info consumes them to avoid extra per-member profile requests; add-member search also shows avatars; advanced moderation still partial)
|
23. Groups - `PARTIAL` (create/add/remove/invite link; join-by-invite and invite permissions covered by integration tests; members API now returns profile fields (`username/name/avatar_url`) and web Chat Info consumes them to avoid extra per-member profile requests; add-member search also shows avatars; advanced moderation still partial)
|
||||||
24. Roles - `DONE` (owner/admin/member)
|
24. Roles - `DONE` (owner/admin/member)
|
||||||
25. Admin Rights - `PARTIAL` (delete/pin/edit info + explicit ban APIs for groups/channels including ban list endpoint; web Chat Info now shows searchable `Banned users` with both inline and right-click `Unban` actions for owner/admin, member search, avatars in moderation lists, invite-link copy/regenerate actions, ban metadata (`who banned/when`), explicit member action button for touch/trackpad UX, and resilient profile hydration (`allSettled`) for partially missing users; integration tests cover channel member read-only, channel admin full-delete, channel message delete-for-all permissions, group profile edit permissions, owner-only role management rules, and admin-visible/member-forbidden ban-list access; remaining UX moderation tools limited)
|
25. Admin Rights - `PARTIAL` (delete/pin/edit info + explicit ban APIs for groups/channels including ban list endpoint; web Chat Info now shows searchable `Banned users` with both inline and right-click `Unban` actions for owner/admin, member search, avatars in moderation lists, invite-link copy/regenerate actions, ban metadata (`who banned/when`), explicit member action button for touch/trackpad UX, and resilient profile hydration (`allSettled`) for partially missing users; integration tests cover channel member read-only, channel admin full-delete, channel message delete-for-all permissions, group profile edit permissions, owner-only role management rules, and admin-visible/member-forbidden ban-list access; remaining UX moderation tools limited)
|
||||||
26. Channels - `PARTIAL` (create/post/edit/delete/subscribe/unsubscribe; integration tests now also cover invite-link permissions (member forbidden, admin allowed); UX edge-cases still polishing)
|
26. Channels - `PARTIAL` (create/post/edit/delete/subscribe/unsubscribe; integration tests now also cover invite-link permissions (member forbidden, admin allowed); web Chat Info differentiates channel actions by role: `Delete channel for all` for owner/admin and `Leave channel` for member; remaining UX edge-cases still polishing)
|
||||||
27. Channel Types - `DONE` (public/private)
|
27. Channel Types - `DONE` (public/private)
|
||||||
28. Notifications - `PARTIAL` (browser notifications + mute/settings; chat mute is propagated in chat list payload, honored by web realtime notifications with mention override, and mute toggle now syncs instantly in chat store; backend now emits `chat_updated` after notification mute/unmute for cross-tab consistency; no mobile push infra)
|
28. Notifications - `PARTIAL` (browser notifications + mute/settings; chat mute is propagated in chat list payload, honored by web realtime notifications with mention override, and mute toggle now syncs instantly in chat store; backend now emits `chat_updated` after notification mute/unmute for cross-tab consistency; no mobile push infra)
|
||||||
29. Archive - `DONE`
|
29. Archive - `DONE`
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
addChatMember,
|
addChatMember,
|
||||||
banChatMember,
|
banChatMember,
|
||||||
createInviteLink,
|
createInviteLink,
|
||||||
|
deleteChat,
|
||||||
getChatAttachments,
|
getChatAttachments,
|
||||||
getMessages,
|
getMessages,
|
||||||
getChatNotificationSettings,
|
getChatNotificationSettings,
|
||||||
@@ -936,6 +937,29 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{showMembersSection && (chat.type === "group" || chat.type === "channel") ? (
|
{showMembersSection && (chat.type === "group" || chat.type === "channel") ? (
|
||||||
|
<>
|
||||||
|
{chat.type === "channel" && (myRoleNormalized === "owner" || myRoleNormalized === "admin") ? (
|
||||||
|
<button
|
||||||
|
className="mb-2 w-full rounded bg-red-500 px-3 py-2 text-sm font-semibold text-white hover:bg-red-400"
|
||||||
|
onClick={async () => {
|
||||||
|
const confirmed = window.confirm("Delete this channel for all subscribers?");
|
||||||
|
if (!confirmed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await deleteChat(chatId, true);
|
||||||
|
await loadChats();
|
||||||
|
setActiveChatId(null);
|
||||||
|
onClose();
|
||||||
|
} catch {
|
||||||
|
setError("Failed to delete channel");
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
Delete channel for all
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
<button
|
<button
|
||||||
className="w-full rounded bg-slate-700 px-3 py-2 text-sm"
|
className="w-full rounded bg-slate-700 px-3 py-2 text-sm"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
@@ -951,6 +975,7 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
|
|||||||
>
|
>
|
||||||
{chat.type === "channel" ? "Leave channel" : "Leave chat"}
|
{chat.type === "channel" ? "Leave channel" : "Leave chat"}
|
||||||
</button>
|
</button>
|
||||||
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
Reference in New Issue
Block a user