Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
yflory 6 years ago
commit 73e068dacc

@ -33,6 +33,7 @@
position: absolute; position: absolute;
top: 5px; top: 5px;
right: 5px; right: 5px;
cursor: pointer;
} }
.cp-help-text { .cp-help-text {
color: @help-text-color; color: @help-text-color;

@ -953,6 +953,16 @@ define([
cb(); cb();
}; };
var clearOwnedChannel = function (id, cb) {
var channel = getChannel(id);
if (!channel) { return void cb({error: 'NO_CHANNEL'}); }
if (!store.rpc) { return void cb({error: 'RPC_NOT_READY'}); }
store.rpc.clearOwnedChannel(id, function (err) {
cb({error:err});
});
channel.messages = [];
}
network.on('disconnect', function () { network.on('disconnect', function () {
emit('DISCONNECT'); emit('DISCONNECT');
}); });
@ -1010,6 +1020,9 @@ define([
if (cmd === 'SET_CHANNEL_HEAD') { if (cmd === 'SET_CHANNEL_HEAD') {
return void setChannelHead(data.id, data.sig, cb); return void setChannelHead(data.id, data.sig, cb);
} }
if (cmd === 'CLEAR_OWNED_CHANNEL') {
return void clearOwnedChannel(data, cb);
}
}; };
Object.freeze(messenger); Object.freeze(messenger);

@ -291,13 +291,12 @@ define([
UI.confirm(Messages.contacts_confirmRemoveHistory, function (yes) { UI.confirm(Messages.contacts_confirmRemoveHistory, function (yes) {
if (!yes) { return; } if (!yes) { return; }
sframeChan.query('Q_CLEAR_OWNED_CHANNEL', id, function (e) { execCommand('CLEAR_OWNED_CHANNEL', id, function (e) {
if (e) { if (e) {
console.error(e); console.error(e);
UI.alert(Messages.contacts_removeHistoryServerError); UI.alert(Messages.contacts_removeHistoryServerError);
return; return;
} }
clearChannel(id);
}); });
}); });
}); });

@ -152,13 +152,9 @@ define([
if (typeof(channel) !== 'string' || channel.length !== 32) { if (typeof(channel) !== 'string' || channel.length !== 32) {
return void cb('INVALID_ARGUMENTS'); return void cb('INVALID_ARGUMENTS');
} }
rpc.send('CLEAR_OWNED_CHANNEL', channel, function (e, response) { rpc.send('CLEAR_OWNED_CHANNEL', channel, function (e) {
if (e) { return cb(e); } if (e) { return cb(e); }
if (response && response.length) { cb();
cb(void 0, response[0]);
} else {
cb('INVALID_RESPONSE');
}
}); });
}; };

Loading…
Cancel
Save