Web:Files: applied changes from 610f738

This commit is contained in:
TimofeyBoyko 2022-06-21 14:09:58 +03:00
parent 3f1623716d
commit 4bf70be27d
3 changed files with 58 additions and 63 deletions

View File

@ -123,14 +123,12 @@ const CreateEvent = ({
})
.then(() => editCompleteAction(id, item, false, type))
.catch((err) => {
console.log("err", err);
const isPasswordError = new RegExp("password");
if (err.indexOf("password") == -1) {
toastr.error(err, t("Common:Warning"));
return;
}
if (isPasswordError.test(err)) {
toastr.error(
t("Translations:FileProtected"),
t("Common:Warning")
);
toastr.error(t("Translations:FileProtected"), t("Common:Warning"));
setIsUpdatingRowItem(false);
@ -148,13 +146,9 @@ const CreateEvent = ({
fileExst: extension,
},
});
setConvertPasswordDialogVisible(true);
open && openDocEditor(null, null, tab);
} else {
toastr.error(e);
}
})
.finally(() => {
const fileIds = [+id];

View File

@ -92,17 +92,18 @@ const ConvertPasswordDialogComponent = (props) => {
onClose();
})
.catch((err) => {
console.log("err", err);
if (err.indexOf("password") == -1) {
toastr.error(err, t("Common:Warning"));
return;
}
const isPasswordError = new RegExp(/\(password\)*$/);
if (isPasswordError.test(err)) {
toastr.error(t("CreationError"), t("Common:Warning"));
if (_isMounted) {
setPasswordValid(false);
focusInput();
}
}
})
.finally(() => {
_isMounted && setIsLoading(false);
});
} else {
@ -116,17 +117,18 @@ const ConvertPasswordDialogComponent = (props) => {
editCompleteAction(actionId, fileInfo, false);
})
.catch((err) => {
console.log("err", err);
const isPasswordError = new RegExp(/\(password\)*$/);
if (isPasswordError.test(err)) {
if (err.indexOf("password") == -1) {
toastr.error(err, t("Common:Warning"));
return;
}
toastr.error(t("CreationError"), t("Common:Warning"));
open && openDocEditor(null, null, tab);
if (_isMounted) {
setPasswordValid(false);
focusInput();
}
}
})
.finally(() => {
_isMounted && setIsLoading(false);
});
}

View File

@ -69,10 +69,10 @@ class ContextOptionsStore {
this.settingsStore.extsWebRestrictedEditing[0];
this.uploadDataStore.copyAsAction(id, newTitle, folderId).catch((err) => {
console.log("err", err);
const isPasswordError = new RegExp(/\(password\)*$/);
if (isPasswordError.test(err)) {
if (err.indexOf("password") == -1) {
toastr.error(err, t("Common:Warning"));
return;
}
toastr.error(t("Translations:FileProtected"), t("Common:Warning"));
setFormCreationInfo({
newTitle,
@ -81,7 +81,6 @@ class ContextOptionsStore {
fileInfo: item,
});
setConvertPasswordDialogVisible(true);
}
});
};