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,38 +123,32 @@ const CreateEvent = ({
})
.then(() => editCompleteAction(id, item, false, type))
.catch((err) => {
console.log("err", err);
const isPasswordError = new RegExp("password");
if (isPasswordError.test(err)) {
toastr.error(
t("Translations:FileProtected"),
t("Common:Warning")
);
setIsUpdatingRowItem(false);
setVisible(false);
setFormCreationInfo({
newTitle: `${newValue}.${extension}`,
fromExst: ".docx",
toExst: extension,
open,
actionId: id,
fileInfo: {
id: templateId,
folderId: parentId,
fileExst: extension,
},
});
setConvertPasswordDialogVisible(true);
open && openDocEditor(null, null, tab);
} else {
toastr.error(e);
if (err.indexOf("password") == -1) {
toastr.error(err, t("Common:Warning"));
return;
}
toastr.error(t("Translations:FileProtected"), t("Common:Warning"));
setIsUpdatingRowItem(false);
setVisible(false);
setFormCreationInfo({
newTitle: `${newValue}.${extension}`,
fromExst: ".docx",
toExst: extension,
open,
actionId: id,
fileInfo: {
id: templateId,
folderId: parentId,
fileExst: extension,
},
});
setConvertPasswordDialogVisible(true);
open && openDocEditor(null, null, tab);
})
.finally(() => {
const fileIds = [+id];

View File

@ -92,17 +92,18 @@ const ConvertPasswordDialogComponent = (props) => {
onClose();
})
.catch((err) => {
console.log("err", err);
const isPasswordError = new RegExp(/\(password\)*$/);
if (isPasswordError.test(err)) {
toastr.error(t("CreationError"), t("Common:Warning"));
if (_isMounted) {
setPasswordValid(false);
focusInput();
}
if (err.indexOf("password") == -1) {
toastr.error(err, t("Common:Warning"));
return;
}
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)) {
toastr.error(t("CreationError"), t("Common:Warning"));
open && openDocEditor(null, null, tab);
if (_isMounted) {
setPasswordValid(false);
focusInput();
}
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,19 +69,18 @@ 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)) {
toastr.error(t("Translations:FileProtected"), t("Common:Warning"));
setFormCreationInfo({
newTitle,
fromExst: fileExst,
toExst: this.settingsStore.extsWebRestrictedEditing[0],
fileInfo: item,
});
setConvertPasswordDialogVisible(true);
if (err.indexOf("password") == -1) {
toastr.error(err, t("Common:Warning"));
return;
}
toastr.error(t("Translations:FileProtected"), t("Common:Warning"));
setFormCreationInfo({
newTitle,
fromExst: fileExst,
toExst: this.settingsStore.extsWebRestrictedEditing[0],
fileInfo: item,
});
setConvertPasswordDialogVisible(true);
});
};