Don't prompt for shared folder password when offline

pull/1/head
yflory 4 years ago
parent 56b227260d
commit 94ce56fbac

@ -50,6 +50,7 @@ define([
isMac: navigator.platform === "MacIntel", isMac: navigator.platform === "MacIntel",
allowFolderUpload: File.prototype.hasOwnProperty("webkitRelativePath"), allowFolderUpload: File.prototype.hasOwnProperty("webkitRelativePath"),
}; };
var onConnectEvt = Util.mkEvent(true);
var stringify = function (obj) { var stringify = function (obj) {
return JSONSortify(obj); return JSONSortify(obj);
@ -280,6 +281,7 @@ define([
} }
state = APP.online && !APP.history && state; state = APP.online && !APP.history && state;
APP.editable = !APP.readOnly && state; APP.editable = !APP.readOnly && state;
if (APP.editable) { onConnectEvt.fire(); }
if (!state) { if (!state) {
APP.$content.addClass('cp-app-drive-readonly'); APP.$content.addClass('cp-app-drive-readonly');
@ -4865,22 +4867,24 @@ define([
onClose: cb onClose: cb
}); });
}; };
var deprecated = files.sharedFoldersTemp; onConnectEvt.reg(function () {
if (typeof (deprecated) === "object" && APP.editable && Object.keys(deprecated).length) { var deprecated = files.sharedFoldersTemp;
Object.keys(deprecated).forEach(function (fId) { if (typeof (deprecated) === "object" && Object.keys(deprecated).length) {
var data = deprecated[fId]; Object.keys(deprecated).forEach(function (fId) {
var sfId = manager.user.userObject.getSFIdFromHref(data.href); var data = deprecated[fId];
if (folders[fId] || sfId) { // This shared folder is already stored in the drive... var sfId = manager.user.userObject.getSFIdFromHref(data.href);
return void manager.delete([['sharedFoldersTemp', fId]], function () { }); if (folders[fId] || sfId) { // This shared folder is already stored in the drive...
} return void manager.delete([['sharedFoldersTemp', fId]], function () { });
nt = nt(function (waitFor) { }
UI.openCustomModal(passwordModal(fId, data, waitFor())); nt = nt(function (waitFor) {
}).nThen; UI.openCustomModal(passwordModal(fId, data, waitFor()));
}); }).nThen;
nt(function () { });
refresh(); nt(function () {
}); refresh();
} });
}
});
return { return {
refresh: refresh, refresh: refresh,

Loading…
Cancel
Save