mirror of https://github.com/xwiki-labs/cryptpad
Fix allow list UI issues
This commit is contained in:
parent
6d8cdca7a3
commit
62725caace
|
@ -4229,18 +4229,20 @@ define([
|
|||
if (err.loaded) {
|
||||
msg += Messages.errorCopy;
|
||||
}
|
||||
if (toolbar && typeof toolbar.deleted === "function") { toolbar.deleted(); }
|
||||
} else if (err.type === 'EDELETED') {
|
||||
if (priv.burnAfterReading) { return void cb(); }
|
||||
msg = Messages.deletedError;
|
||||
if (err.loaded) {
|
||||
msg += Messages.errorCopy;
|
||||
}
|
||||
if (toolbar && typeof toolbar.deleted === "function") { toolbar.deleted(); }
|
||||
} else if (err.type === 'ERESTRICTED') {
|
||||
msg = Messages.restrictedError;
|
||||
if (toolbar && typeof toolbar.failed === "function") { toolbar.failed(true); }
|
||||
}
|
||||
var sframeChan = common.getSframeChannel();
|
||||
sframeChan.event('EV_SHARE_OPEN', {hidden: true});
|
||||
if (toolbar && typeof toolbar.deleted === "function") { toolbar.deleted(); }
|
||||
UI.errorLoadingScreen(msg, Boolean(err.loaded), Boolean(err.loaded));
|
||||
(cb || function () {})();
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@ define([
|
|||
data.mailbox = obj.mailbox;
|
||||
data.restricted = obj.restricted;
|
||||
data.allowed = obj.allowed;
|
||||
data.rejected = obj.rejected;
|
||||
};
|
||||
var loadMetadata = function (common, data, waitFor, redraw) {
|
||||
common.getPadMetadata({
|
||||
|
@ -882,7 +883,7 @@ define([
|
|||
if (_ownersGrid && _ownersGrid.div) {
|
||||
content.push(h('label', Messages.creation_owners));
|
||||
content.push(_ownersGrid.div);
|
||||
} else {
|
||||
} else if (!data.rejected) {
|
||||
content.push(UI.dialog.selectable(Messages.creation_noOwner, {
|
||||
id: 'cp-app-prop-owners',
|
||||
}));
|
||||
|
|
|
@ -1523,11 +1523,11 @@ define([
|
|||
},
|
||||
onError: function (err) {
|
||||
channel.bcast("PAD_ERROR", err);
|
||||
delete channels[data.channel];
|
||||
Store.leavePad(null, data, function () {});
|
||||
},
|
||||
onChannelError: function (err) {
|
||||
channel.bcast("PAD_ERROR", err);
|
||||
delete channels[data.channel];
|
||||
Store.leavePad(null, data, function () {});
|
||||
},
|
||||
onConnectionChange: function (info) {
|
||||
if (!info.state) {
|
||||
|
@ -1777,6 +1777,10 @@ define([
|
|||
var metadata = (obj && obj[0]) || {};
|
||||
cb(metadata);
|
||||
|
||||
// If you don't have access to the metadata, stop here
|
||||
// (we can't update the local data)
|
||||
if (metadata.rejected) { return; }
|
||||
|
||||
// Update owners and expire time in the drive
|
||||
getAllStores().forEach(function (s) {
|
||||
var allData = s.manager.findChannel(data.channel, true);
|
||||
|
|
|
@ -60,7 +60,6 @@ define([
|
|||
if (!c) {
|
||||
c = ctx.clients[client] = {
|
||||
channel: channel,
|
||||
padChan: padChan,
|
||||
cursor: {}
|
||||
};
|
||||
} else {
|
||||
|
@ -95,6 +94,8 @@ define([
|
|||
ctx.channels[channel] = ctx.channels[channel] || {};
|
||||
|
||||
var chan = ctx.channels[channel];
|
||||
chan.padChan = padChan;
|
||||
|
||||
if (!c.id) { c.id = wc.myID + '-' + client; }
|
||||
if (chan.clients) {
|
||||
// If 2 tabs from the same worker have been opened at the same time,
|
||||
|
|
|
@ -12,7 +12,6 @@ define([
|
|||
if (!c) {
|
||||
c = ctx.clients[client] = {
|
||||
channel: channel,
|
||||
padChan: padChan,
|
||||
};
|
||||
} else {
|
||||
return void cb();
|
||||
|
@ -45,6 +44,7 @@ define([
|
|||
};
|
||||
|
||||
chan = ctx.channels[channel];
|
||||
chan.padChan = padChan;
|
||||
|
||||
// Create our client ID using the netflux ID
|
||||
if (!c.id) { c.id = wc.myID + '-' + client; }
|
||||
|
|
|
@ -161,6 +161,10 @@ define([
|
|||
}
|
||||
case STATE.ERROR: {
|
||||
evStart.reg(function () {
|
||||
if (text === 'ERESTRICTED') {
|
||||
toolbar.failed(true);
|
||||
return;
|
||||
}
|
||||
toolbar.errorState(true, text);
|
||||
var msg = Messages.chainpadError;
|
||||
UI.errorLoadingScreen(msg, true, true);
|
||||
|
@ -171,6 +175,10 @@ define([
|
|||
evStart.reg(function () { toolbar.forgotten(); });
|
||||
break;
|
||||
}
|
||||
case STATE.FORBIDDEN: {
|
||||
evStart.reg(function () { toolbar.deleted(); });
|
||||
break;
|
||||
}
|
||||
case STATE.DELETED: {
|
||||
evStart.reg(function () { toolbar.deleted(); });
|
||||
break;
|
||||
|
@ -403,7 +411,11 @@ define([
|
|||
};
|
||||
|
||||
var onError = function (err) {
|
||||
common.onServerError(err, toolbar, function () {
|
||||
common.onServerError(err, null, function () {
|
||||
if (err.type === 'ERESTRICTED') {
|
||||
stateChange(STATE.ERROR, err.type);
|
||||
return;
|
||||
}
|
||||
stateChange(STATE.DELETED);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -166,14 +166,14 @@ MessengerUI, Messages) {
|
|||
});
|
||||
};
|
||||
var showColors = false;
|
||||
var updateUserList = function (toolbar, config) {
|
||||
var updateUserList = function (toolbar, config, forceOffline) {
|
||||
if (!config.displayed || config.displayed.indexOf('userlist') === -1) { return; }
|
||||
// Make sure the elements are displayed
|
||||
var $userButtons = toolbar.userlist;
|
||||
var $userlistContent = toolbar.userlistContent;
|
||||
|
||||
var metadataMgr = config.metadataMgr;
|
||||
var online = metadataMgr.isConnected();
|
||||
var online = !forceOffline && metadataMgr.isConnected();
|
||||
var userData = metadataMgr.getMetadata().users;
|
||||
var viewers = metadataMgr.getViewers();
|
||||
var priv = metadataMgr.getPrivateData();
|
||||
|
@ -1260,12 +1260,15 @@ MessengerUI, Messages) {
|
|||
initClickEvents(toolbar, config);
|
||||
initNotifications(toolbar, config);
|
||||
|
||||
var failed = toolbar.failed = function () {
|
||||
var failed = toolbar.failed = function (hideUserList) {
|
||||
toolbar.connected = false;
|
||||
|
||||
if (toolbar.spinner) {
|
||||
toolbar.spinner.text(Messages.disconnected);
|
||||
}
|
||||
if (hideUserList) {
|
||||
updateUserList(toolbar, config, true);
|
||||
}
|
||||
//checkLag(toolbar, config);
|
||||
};
|
||||
toolbar.initializing = function (/*userId*/) {
|
||||
|
@ -1312,7 +1315,7 @@ MessengerUI, Messages) {
|
|||
toolbar.deleted = function (/*userId*/) {
|
||||
toolbar.isErrorState = true;
|
||||
toolbar.connected = false;
|
||||
updateUserList(toolbar, config);
|
||||
updateUserList(toolbar, config, true);
|
||||
if (toolbar.spinner) {
|
||||
toolbar.spinner.text(Messages.deletedFromServer);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue