Group settings: on block and leave, don't delete
This commit is contained in:
parent
4978fae69c
commit
3face767aa
6 changed files with 26 additions and 29 deletions
|
@ -68,8 +68,8 @@ const createProps = (hasGroupLink = false): Props => ({
|
||||||
updateGroupAttributes: async () => {
|
updateGroupAttributes: async () => {
|
||||||
action('updateGroupAttributes')();
|
action('updateGroupAttributes')();
|
||||||
},
|
},
|
||||||
onBlockAndDelete: action('onBlockAndDelete'),
|
onBlock: action('onBlock'),
|
||||||
onDelete: action('onDelete'),
|
onLeave: action('onLeave'),
|
||||||
});
|
});
|
||||||
|
|
||||||
story.add('Basic', () => {
|
story.add('Basic', () => {
|
||||||
|
|
|
@ -55,8 +55,8 @@ export type StateProps = {
|
||||||
title?: string;
|
title?: string;
|
||||||
}>
|
}>
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
onBlockAndDelete: () => void;
|
onBlock: () => void;
|
||||||
onDelete: () => void;
|
onLeave: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Props = StateProps;
|
export type Props = StateProps;
|
||||||
|
@ -78,8 +78,8 @@ export const ConversationDetails: React.ComponentType<Props> = ({
|
||||||
showPendingInvites,
|
showPendingInvites,
|
||||||
showLightboxForMedia,
|
showLightboxForMedia,
|
||||||
updateGroupAttributes,
|
updateGroupAttributes,
|
||||||
onBlockAndDelete,
|
onBlock,
|
||||||
onDelete,
|
onLeave,
|
||||||
}) => {
|
}) => {
|
||||||
const [modalState, setModalState] = useState<ModalState>(
|
const [modalState, setModalState] = useState<ModalState>(
|
||||||
ModalState.NothingOpen
|
ModalState.NothingOpen
|
||||||
|
@ -301,8 +301,8 @@ export const ConversationDetails: React.ComponentType<Props> = ({
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
cannotLeaveBecauseYouAreLastAdmin={cannotLeaveBecauseYouAreLastAdmin}
|
cannotLeaveBecauseYouAreLastAdmin={cannotLeaveBecauseYouAreLastAdmin}
|
||||||
conversationTitle={conversation.title}
|
conversationTitle={conversation.title}
|
||||||
onDelete={onDelete}
|
onLeave={onLeave}
|
||||||
onBlockAndDelete={onBlockAndDelete}
|
onBlock={onBlock}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{modalNode}
|
{modalNode}
|
||||||
|
|
|
@ -28,8 +28,8 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
||||||
? overrideProps.cannotLeaveBecauseYouAreLastAdmin
|
? overrideProps.cannotLeaveBecauseYouAreLastAdmin
|
||||||
: false,
|
: false,
|
||||||
conversationTitle: overrideProps.conversationTitle || '',
|
conversationTitle: overrideProps.conversationTitle || '',
|
||||||
onBlockAndDelete: action('onBlockAndDelete'),
|
onBlock: action('onBlock'),
|
||||||
onDelete: action('onDelete'),
|
onLeave: action('onLeave'),
|
||||||
i18n,
|
i18n,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,16 @@ import { ConversationDetailsIcon } from './ConversationDetailsIcon';
|
||||||
export type Props = {
|
export type Props = {
|
||||||
cannotLeaveBecauseYouAreLastAdmin: boolean;
|
cannotLeaveBecauseYouAreLastAdmin: boolean;
|
||||||
conversationTitle: string;
|
conversationTitle: string;
|
||||||
onBlockAndDelete: () => void;
|
onBlock: () => void;
|
||||||
onDelete: () => void;
|
onLeave: () => void;
|
||||||
i18n: LocalizerType;
|
i18n: LocalizerType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ConversationDetailsActions: React.ComponentType<Props> = ({
|
export const ConversationDetailsActions: React.ComponentType<Props> = ({
|
||||||
cannotLeaveBecauseYouAreLastAdmin,
|
cannotLeaveBecauseYouAreLastAdmin,
|
||||||
conversationTitle,
|
conversationTitle,
|
||||||
onBlockAndDelete,
|
onBlock,
|
||||||
onDelete,
|
onLeave,
|
||||||
i18n,
|
i18n,
|
||||||
}) => {
|
}) => {
|
||||||
const [confirmingLeave, setConfirmingLeave] = React.useState<boolean>(false);
|
const [confirmingLeave, setConfirmingLeave] = React.useState<boolean>(false);
|
||||||
|
@ -94,7 +94,7 @@ export const ConversationDetailsActions: React.ComponentType<Props> = ({
|
||||||
text: i18n(
|
text: i18n(
|
||||||
'ConversationDetailsActions--leave-group-modal-confirm'
|
'ConversationDetailsActions--leave-group-modal-confirm'
|
||||||
),
|
),
|
||||||
action: onDelete,
|
action: onLeave,
|
||||||
style: 'affirmative',
|
style: 'affirmative',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
@ -113,7 +113,7 @@ export const ConversationDetailsActions: React.ComponentType<Props> = ({
|
||||||
text: i18n(
|
text: i18n(
|
||||||
'ConversationDetailsActions--block-group-modal-confirm'
|
'ConversationDetailsActions--block-group-modal-confirm'
|
||||||
),
|
),
|
||||||
action: onBlockAndDelete,
|
action: onBlock,
|
||||||
style: 'affirmative',
|
style: 'affirmative',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
|
|
@ -36,8 +36,8 @@ export type SmartConversationDetailsProps = {
|
||||||
title?: string;
|
title?: string;
|
||||||
}>
|
}>
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
onBlockAndDelete: () => void;
|
onBlock: () => void;
|
||||||
onDelete: () => void;
|
onLeave: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (
|
const mapStateToProps = (
|
||||||
|
|
|
@ -3067,22 +3067,19 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
// these methods are used in more than one place and should probably be
|
// these methods are used in more than one place and should probably be
|
||||||
// dried up and hoisted to methods on ConversationView
|
// dried up and hoisted to methods on ConversationView
|
||||||
|
|
||||||
const onDelete = () => {
|
const onLeave = () => {
|
||||||
this.longRunningTaskWrapper({
|
this.longRunningTaskWrapper({
|
||||||
name: 'onDelete',
|
name: 'onLeave',
|
||||||
task: this.model.syncMessageRequestResponse.bind(
|
task: () => this.model.leaveGroupV2(),
|
||||||
this.model,
|
|
||||||
messageRequestEnum.DELETE
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onBlockAndDelete = () => {
|
const onBlock = () => {
|
||||||
this.longRunningTaskWrapper({
|
this.longRunningTaskWrapper({
|
||||||
name: 'onBlockAndDelete',
|
name: 'onBlock',
|
||||||
task: this.model.syncMessageRequestResponse.bind(
|
task: this.model.syncMessageRequestResponse.bind(
|
||||||
this.model,
|
this.model,
|
||||||
messageRequestEnum.BLOCK_AND_DELETE
|
messageRequestEnum.BLOCK
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -3110,8 +3107,8 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
updateGroupAttributes: conversation.updateGroupAttributesV2.bind(
|
updateGroupAttributes: conversation.updateGroupAttributesV2.bind(
|
||||||
conversation
|
conversation
|
||||||
),
|
),
|
||||||
onDelete,
|
onLeave,
|
||||||
onBlockAndDelete,
|
onBlock,
|
||||||
};
|
};
|
||||||
|
|
||||||
const view = new Whisper.ReactWrapperView({
|
const view = new Whisper.ReactWrapperView({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue