diff --git a/src/common/component/Contact/ContextMenu.js b/src/common/component/Contact/ContextMenu.js index a68ee9f2..cb06c3d5 100644 --- a/src/common/component/Contact/ContextMenu.js +++ b/src/common/component/Contact/ContextMenu.js @@ -18,8 +18,10 @@ export default function ContactContextMenu({ copyEmail, canCopyEmail, startChat, + canRemove, canRemoveFromChannel, removeFromChannel, + removeUser, } = useContactOperation({ uid, cid, @@ -56,6 +58,11 @@ export default function ContactContextMenu({ title: "Remove From Channel", handler: removeFromChannel, }, + canRemove && { + danger: true, + title: "Remove From Server", + handler: removeUser, + }, ]} /> } diff --git a/src/common/component/ContextMenu.js b/src/common/component/ContextMenu.js index 58f5a291..69f2b5fd 100644 --- a/src/common/component/ContextMenu.js +++ b/src/common/component/ContextMenu.js @@ -25,6 +25,8 @@ export default function ContextMenu({ items = [], hideMenu = null }) { }`} key={title} onClick={(evt) => { + evt.stopPropagation(); + evt.preventDefault(); handler(evt); if (hideMenu) { hideMenu(); diff --git a/src/common/hook/useContactOperation.js b/src/common/hook/useContactOperation.js index 115e819a..f13ec7da 100644 --- a/src/common/hook/useContactOperation.js +++ b/src/common/hook/useContactOperation.js @@ -69,7 +69,7 @@ export default function useContactOperation({ uid, cid }) { const canRemoveFromChannel = cid && !channel?.is_public && (isAdmin || channel?.owner == loginUid); const canCall = loginUid != uid; - const canRemove = isAdmin && loginUid != uid; + const canRemove = isAdmin && loginUid != uid && !cid; return { canRemove, removeUser: handleRemove, diff --git a/src/routes/contacts/index.js b/src/routes/contacts/index.js index 9fba23bc..6455528b 100644 --- a/src/routes/contacts/index.js +++ b/src/routes/contacts/index.js @@ -33,7 +33,7 @@ export default function ContactsPage() { {contactIds.map((uid) => { return ( - + ); })}