parent
faea93e5ce
commit
606103be8d
4 changed files with 19 additions and 5 deletions
|
@ -52,7 +52,10 @@ function getToast(toastType: ToastType): AnyToast {
|
||||||
case ToastType.ConversationArchived:
|
case ToastType.ConversationArchived:
|
||||||
return {
|
return {
|
||||||
toastType: ToastType.ConversationArchived,
|
toastType: ToastType.ConversationArchived,
|
||||||
parameters: { conversationId: 'some-conversation-id' },
|
parameters: {
|
||||||
|
conversationId: 'some-conversation-id',
|
||||||
|
wasPinned: false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
case ToastType.ConversationMarkedUnread:
|
case ToastType.ConversationMarkedUnread:
|
||||||
return { toastType: ToastType.ConversationMarkedUnread };
|
return { toastType: ToastType.ConversationMarkedUnread };
|
||||||
|
|
|
@ -23,7 +23,10 @@ export type PropsType = {
|
||||||
openFileInFolder: (target: string) => unknown;
|
openFileInFolder: (target: string) => unknown;
|
||||||
OS: string;
|
OS: string;
|
||||||
onShowDebugLog: () => unknown;
|
onShowDebugLog: () => unknown;
|
||||||
onUndoArchive: (conversaetionId: string) => unknown;
|
onUndoArchive: (
|
||||||
|
conversationId: string,
|
||||||
|
options?: { wasPinned?: boolean }
|
||||||
|
) => unknown;
|
||||||
toast?: AnyToast;
|
toast?: AnyToast;
|
||||||
megaphone?: AnyActionableMegaphone;
|
megaphone?: AnyActionableMegaphone;
|
||||||
centerToast?: boolean;
|
centerToast?: boolean;
|
||||||
|
@ -166,7 +169,9 @@ export function renderToast({
|
||||||
toastAction={{
|
toastAction={{
|
||||||
label: i18n('icu:conversationArchivedUndo'),
|
label: i18n('icu:conversationArchivedUndo'),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
onUndoArchive(String(toast.parameters.conversationId));
|
onUndoArchive(String(toast.parameters.conversationId), {
|
||||||
|
wasPinned: toast.parameters.wasPinned,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
@ -1201,6 +1201,7 @@ function onArchive(
|
||||||
throw new Error('onArchive: Conversation not found!');
|
throw new Error('onArchive: Conversation not found!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wasPinned = conversation.attributes.isPinned ?? false;
|
||||||
conversation.setArchived(true);
|
conversation.setArchived(true);
|
||||||
|
|
||||||
onConversationClosed(conversationId, 'archive')(
|
onConversationClosed(conversationId, 'archive')(
|
||||||
|
@ -1215,13 +1216,15 @@ function onArchive(
|
||||||
toastType: ToastType.ConversationArchived,
|
toastType: ToastType.ConversationArchived,
|
||||||
parameters: {
|
parameters: {
|
||||||
conversationId,
|
conversationId,
|
||||||
|
wasPinned,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function onUndoArchive(
|
function onUndoArchive(
|
||||||
conversationId: string
|
conversationId: string,
|
||||||
|
options: { wasPinned?: boolean } = {}
|
||||||
): ThunkAction<
|
): ThunkAction<
|
||||||
void,
|
void,
|
||||||
RootStateType,
|
RootStateType,
|
||||||
|
@ -1235,6 +1238,9 @@ function onUndoArchive(
|
||||||
}
|
}
|
||||||
|
|
||||||
conversation.setArchived(false);
|
conversation.setArchived(false);
|
||||||
|
if (options.wasPinned) {
|
||||||
|
conversation.pin();
|
||||||
|
}
|
||||||
showConversation({
|
showConversation({
|
||||||
conversationId,
|
conversationId,
|
||||||
})(dispatch, getState, null);
|
})(dispatch, getState, null);
|
||||||
|
|
|
@ -89,7 +89,7 @@ export type AnyToast =
|
||||||
| { toastType: ToastType.CaptchaSolved }
|
| { toastType: ToastType.CaptchaSolved }
|
||||||
| {
|
| {
|
||||||
toastType: ToastType.ConversationArchived;
|
toastType: ToastType.ConversationArchived;
|
||||||
parameters: { conversationId: string };
|
parameters: { conversationId: string; wasPinned: boolean };
|
||||||
}
|
}
|
||||||
| { toastType: ToastType.ConversationMarkedUnread }
|
| { toastType: ToastType.ConversationMarkedUnread }
|
||||||
| { toastType: ToastType.ConversationRemoved; parameters: { title: string } }
|
| { toastType: ToastType.ConversationRemoved; parameters: { title: string } }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue