Web: Files: fix "getsharingkeys" working

This commit is contained in:
Alexey Safronov 2021-01-20 12:36:35 +03:00
parent 6ba783e3ef
commit bf7a5d81df
2 changed files with 28 additions and 7 deletions

View File

@ -74,8 +74,30 @@ class PureEditor extends React.Component {
user,
isEncryption,
config.editorConfig.encryptionKeys,
(keys) => api.files.setEncryptionKeys(keys),
true
(keys) => {
api.files.setEncryptionKeys(keys);
},
true,
(callback) => {
api.files
.getEncryptionAccess(fileId)
.then((keys) => {
var data = {
keys,
};
callback(data);
})
.catch((error) => {
console.log(error);
toastr.error(
typeof error === "string" ? error : error.message,
null,
0,
true
);
});
}
);
}

View File

@ -1,10 +1,7 @@
import toastr from "../components/Toast/toastr";
//import store from "../store/index";
import isEmpty from "lodash/isEmpty";
import omit from "lodash/omit";
//const { getEncryptionAccess } = store.auth.actions;
export const desktopConstants = Object.freeze({
domain: window.location.origin,
provider: "AppServer",
@ -16,7 +13,8 @@ export function regDesktop(
isEncryption,
keys,
setEncryptionKeys,
isEditor
isEditor,
getEncryptionAccess
) {
const data = {
displayName: user.displayName,
@ -65,7 +63,8 @@ export function regDesktop(
break;
}
case "getsharingkeys":
if (!isEditor) return;
if (!isEditor && typeof getEncryptionAccess === "function") return;
getEncryptionAccess(callback);
break;
default:
break;