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; var noSharedWorker = false;
if (localStorage.CryptPad_noWorkers) { if (localStorage.CryptPad_noWorkers) {
noWorker = localStorage.CryptPad_noWorkers === '1'; noWorker = localStorage.CryptPad_noWorkers === '1';
noWorker = true;
console.error('WebWorker/SharedWorker state forced to ' + !noWorker); console.error('WebWorker/SharedWorker state forced to ' + !noWorker);
} }
Nthen(function (waitFor2) { Nthen(function (waitFor2) {

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

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

@ -61,6 +61,14 @@ define([
sframeChan.query('Q_DRIVE_GETOBJECT', { sframeChan.query('Q_DRIVE_GETOBJECT', {
sharedFolder: fId sharedFolder: fId
}, waitFor(function (err, newObj) { }, 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] || {}; folders[fId] = folders[fId] || {};
copyObjectValue(folders[fId], newObj); copyObjectValue(folders[fId], newObj);
folders[fId].readOnly = !secret.keys.secondaryKey; folders[fId].readOnly = !secret.keys.secondaryKey;

Loading…
Cancel
Save