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,8 +4867,9 @@ define([
onClose: cb onClose: cb
}); });
}; };
onConnectEvt.reg(function () {
var deprecated = files.sharedFoldersTemp; var deprecated = files.sharedFoldersTemp;
if (typeof (deprecated) === "object" && APP.editable && Object.keys(deprecated).length) { if (typeof (deprecated) === "object" && Object.keys(deprecated).length) {
Object.keys(deprecated).forEach(function (fId) { Object.keys(deprecated).forEach(function (fId) {
var data = deprecated[fId]; var data = deprecated[fId];
var sfId = manager.user.userObject.getSFIdFromHref(data.href); var sfId = manager.user.userObject.getSFIdFromHref(data.href);
@ -4881,6 +4884,7 @@ define([
refresh(); refresh();
}); });
} }
});
return { return {
refresh: refresh, refresh: refresh,

Loading…
Cancel
Save