be able to remove a closed group once we left it already

pull/1467/head
Audric Ackermann 4 years ago
parent 7048f81214
commit 6ed5f505c3
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -125,6 +125,7 @@ export const ConversationHeaderMenu = (props: PropsConversationHeaderMenu) => {
isMe, isMe,
isGroup, isGroup,
isPublic, isPublic,
left,
onDeleteContact, onDeleteContact,
window.i18n window.i18n
)} )}

@ -92,6 +92,7 @@ export const ConversationListItemContextMenu = (
isMe, isMe,
type === 'group', type === 'group',
isPublic, isPublic,
left,
onDeleteContact, onDeleteContact,
window.i18n window.i18n
)} )}

@ -39,9 +39,11 @@ function showCopyId(isPublic: boolean, isGroup: boolean): boolean {
function showDeleteContact( function showDeleteContact(
isMe: boolean, isMe: boolean,
isGroup: boolean, isGroup: boolean,
isPublic: boolean isPublic: boolean,
isGroupLeft: boolean
): boolean { ): boolean {
return !isMe && Boolean(!isGroup || isPublic); // you need to have left a closed group first to be able to delete it completely.
return (!isMe && !isGroup) || (isGroup && isGroupLeft);
} }
function showAddModerators( function showAddModerators(
@ -97,10 +99,18 @@ export function getDeleteContactMenuItem(
isMe: boolean | undefined, isMe: boolean | undefined,
isGroup: boolean | undefined, isGroup: boolean | undefined,
isPublic: boolean | undefined, isPublic: boolean | undefined,
isLeft: boolean | undefined,
action: any, action: any,
i18n: LocalizerType i18n: LocalizerType
): JSX.Element | null { ): JSX.Element | null {
if (showDeleteContact(Boolean(isMe), Boolean(isGroup), Boolean(isPublic))) { if (
showDeleteContact(
Boolean(isMe),
Boolean(isGroup),
Boolean(isPublic),
Boolean(isLeft)
)
) {
if (isPublic) { if (isPublic) {
return <Item onClick={action}>{i18n('leaveGroup')}</Item>; return <Item onClick={action}>{i18n('leaveGroup')}</Item>;
} }

Loading…
Cancel
Save