Fix deprecated shared folder in read-only team

pull/1/head
yflory 5 years ago
parent 37a72d2f87
commit 49766d006f

@ -1524,7 +1524,6 @@ define([
var noSharedWorker = false;
if (localStorage.CryptPad_noWorkers) {
noWorker = localStorage.CryptPad_noWorkers === '1';
noWorker = true;
console.error('WebWorker/SharedWorker state forced to ' + !noWorker);
}
Nthen(function (waitFor2) {

@ -1798,6 +1798,11 @@ define([
if (!manager.isFile(element)) { return; }
var data = manager.getFileData(element);
if (!Object.keys(data).length) {
return true;
}
var href = data.href || data.roHref;
if (!data) { return void logError("No data for the file", element); }
@ -1958,10 +1963,14 @@ define([
if (isTrash) { return; }
openFile(root[key]);
});
var invalid;
if (isFolder) {
addFolderData(element, key, $element);
invalid = addFolderData(element, key, $element);
} else {
addFileData(element, $element);
invalid = addFileData(element, $element);
}
if (invalid) {
return;
}
$element.addClass(liClass);
var droppable = !isTrash && !APP.$content.data('readOnlyFolder');

@ -54,9 +54,9 @@ define([
var deprecateProxy = function (Env, id, channel) {
if (Env.user.userObject.readOnly) {
// In a read-only team, we can't deprecate a shared folder
if (Env.folders[id]) {
Env.folders[id].proxy = { deprecated: true };
}
// Use a empty object with a deprecated flag...
var lm = { proxy: { deprecated: true } };
addProxy(Env, id, lm, function () {});
return void Env.Store.refreshDriveUI();
}
if (channel) { Env.unpinPads([channel], function () {}); }

@ -61,6 +61,14 @@ define([
sframeChan.query('Q_DRIVE_GETOBJECT', {
sharedFolder: fId
}, waitFor(function (err, newObj) {
if (newObj && newObj.deprecated) {
delete folders[fId];
delete drive.sharedFolders[fId];
if (manager && manager.folders) {
delete manager.folders[fId];
}
return;
}
folders[fId] = folders[fId] || {};
copyObjectValue(folders[fId], newObj);
folders[fId].readOnly = !secret.keys.secondaryKey;

Loading…
Cancel
Save