Web: Files: refactoring private rooms page
This commit is contained in:
parent
1b685a7b5e
commit
2cd83d0897
@ -160,7 +160,7 @@ export default function withFileActions(WrappedFileItem) {
|
||||
encrypted,
|
||||
} = item;
|
||||
|
||||
if (encrypted && isPrivacy) return checkProtocol(item.id);
|
||||
if (encrypted && isPrivacy) return checkProtocol(item.id, true);
|
||||
|
||||
if (isTrashFolder) return;
|
||||
|
||||
|
@ -144,18 +144,19 @@ export const loopTreeFolders = (
|
||||
});
|
||||
};
|
||||
|
||||
export const checkProtocol = (fileId) =>
|
||||
export const checkProtocol = (fileId, withRedirect) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const onBlur = () => {
|
||||
clearTimeout(timeout);
|
||||
window.removeEventListener("blur", onBlur);
|
||||
resolve(true);
|
||||
resolve();
|
||||
};
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
reject(false);
|
||||
reject();
|
||||
window.removeEventListener("blur", onBlur);
|
||||
window.open(`/products/files/private?fileId=${fileId}`, "_blank");
|
||||
withRedirect &&
|
||||
window.open(`/products/files/private?fileId=${fileId}`, "_blank");
|
||||
}, 1000);
|
||||
|
||||
window.addEventListener("blur", onBlur);
|
||||
|
@ -102,15 +102,12 @@ const PrivacyPageComponent = ({ t, history, tReady }) => {
|
||||
|
||||
const onOpenEditorsPopup = async () => {
|
||||
setIsDisabled(true);
|
||||
const isInstalled = await checkProtocol(
|
||||
history.location.search.split("=")[1]
|
||||
);
|
||||
|
||||
if (isInstalled) setIsDisabled(false);
|
||||
else {
|
||||
setIsDisabled(false);
|
||||
toastr.info(t("PrivacyEditors"));
|
||||
}
|
||||
checkProtocol(history.location.search.split("=")[1])
|
||||
.then(() => setIsDisabled(false))
|
||||
.catch(() => {
|
||||
setIsDisabled(false);
|
||||
toastr.info(t("PrivacyEditors"));
|
||||
});
|
||||
};
|
||||
|
||||
return !tReady ? (
|
||||
|
Loading…
Reference in New Issue
Block a user