mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-10 18:10:54 +09:00
JS-4229: fix
This commit is contained in:
parent
c0982e26ae
commit
921ce79891
2 changed files with 22 additions and 11 deletions
|
@ -1666,6 +1666,9 @@
|
|||
"spaceDeleteWarningTitle": "Delete \"%s\" space",
|
||||
"spaceDeleteWarningText": "This space will be deleted irrevocably. You can't undo this action.",
|
||||
"spaceDeleteToast": "Space \"%s\" was deleted",
|
||||
"spaceLeaveWarningTitle": "Leave a space",
|
||||
"spaceLeaveWarningText": "\"%s\" will be removed from your devices and you will no longer have access to it",
|
||||
"spaceLeaveToast": "You have left the \"%s\" space",
|
||||
|
||||
"quickOption0": "Exact date",
|
||||
"quickOption1": "Yesterday",
|
||||
|
|
|
@ -543,23 +543,31 @@ class Action {
|
|||
};
|
||||
|
||||
removeSpace (id: string, route: string, callBack?: (message: any) => void) {
|
||||
const { accountSpaceId } = authStore;
|
||||
const space = UtilSpace.getSpaceview();
|
||||
const deleted = UtilSpace.getSpaceviewBySpaceId(id);
|
||||
|
||||
if (!deleted) {
|
||||
return;
|
||||
};
|
||||
|
||||
analytics.event('ClickDeleteSpace', { route });
|
||||
const { accountSpaceId } = authStore;
|
||||
const { space } = commonStore;
|
||||
const isOwner = UtilSpace.isOwner(id);
|
||||
const name = UtilCommon.shorten(deleted.name, 32);
|
||||
const suffix = isOwner ? 'Delete' : 'Leave';
|
||||
const title = UtilCommon.sprintf(translate(`space${suffix}WarningTitle`), name);
|
||||
const text = UtilCommon.sprintf(translate(`space${suffix}WarningText`), name);
|
||||
const toast = UtilCommon.sprintf(translate(`space${suffix}Toast`), name);
|
||||
const confirm = isOwner ? translate('commonDelete') : translate('commonLeaveSpace');
|
||||
|
||||
analytics.event(`Click${suffix}Space`, { route });
|
||||
|
||||
popupStore.open('confirm', {
|
||||
data: {
|
||||
title: UtilCommon.sprintf(translate('spaceDeleteWarningTitle'), deleted.name),
|
||||
text: translate('spaceDeleteWarningText'),
|
||||
textConfirm: translate('commonDelete'),
|
||||
title,
|
||||
text,
|
||||
textConfirm: confirm,
|
||||
onConfirm: () => {
|
||||
analytics.event('ClickDeleteSpaceWarning', { type: 'Delete', route });
|
||||
analytics.event(`Click${suffix}SpaceWarning`, { type: suffix, route });
|
||||
|
||||
const cb = () => {
|
||||
C.SpaceDelete(id, (message: any) => {
|
||||
|
@ -568,20 +576,20 @@ class Action {
|
|||
};
|
||||
|
||||
if (!message.error.code) {
|
||||
Preview.toastShow({ text: UtilCommon.sprintf(translate('spaceDeleteToast'), deleted.name) });
|
||||
analytics.event('DeleteSpace', { type: deleted.spaceAccessType, route });
|
||||
Preview.toastShow({ text: toast });
|
||||
analytics.event(`${suffix}Space`, { type: deleted.spaceAccessType, route });
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
if (space.id == deleted.id) {
|
||||
if (space == id) {
|
||||
UtilRouter.switchSpace(accountSpaceId, '', cb);
|
||||
} else {
|
||||
cb();
|
||||
};
|
||||
},
|
||||
onCancel: () => {
|
||||
analytics.event('ClickDeleteSpaceWarning', { type: 'Cancel', route });
|
||||
analytics.event(`Click${suffix}SpaceWarning`, { type: 'Cancel', route });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue