repair broken 'clear channel' button

pull/1/head
ansuz 7 years ago
parent 2ff1a17ade
commit 585f9d2e4e

@ -633,6 +633,13 @@ define([
}); });
}; };
messenger.clearOwnedChannel = function (channel, cb) {
common.clearOwnedChannel(channel, function (e) {
if (e) { return void cb(e); }
cb();
});
};
// TODO listen for changes to your friend list // TODO listen for changes to your friend list
// emit 'update' events for clients // emit 'update' events for clients

@ -559,6 +559,13 @@ define([
}); });
}); });
}); });
sframeChan.on('Q_CONTACTS_CLEAR_OWNED_CHANNEL', function (channel, cb) {
messenger.clearOwnedChannel(channel, function (e) {
cb({
error: e,
});
});
});
messenger.on('message', function (message) { messenger.on('message', function (message) {
sframeChan.event('EV_CONTACTS_MESSAGE', message); sframeChan.event('EV_CONTACTS_MESSAGE', message);

@ -108,6 +108,12 @@ define([], function () {
}); });
}; };
messenger.clearOwnedChannel = function (channel, cb) {
sFrameChan.query('Q_CONTACTS_CLEAR_OWNED_CHANNEL', channel, function (e) {
cb(e);
});
};
return messenger; return messenger;
}; };

@ -156,6 +156,7 @@ define({
'Q_CONTACTS_GET_MORE_HISTORY': true, 'Q_CONTACTS_GET_MORE_HISTORY': true,
'Q_CONTACTS_SEND_MESSAGE': true, 'Q_CONTACTS_SEND_MESSAGE': true,
'Q_CONTACTS_SET_CHANNEL_HEAD': true, 'Q_CONTACTS_SET_CHANNEL_HEAD': true,
'Q_CONTACTS_CLEAR_OWNED_CHANNEL': true,
// Put one or more entries to the localStore which will go in localStorage. // Put one or more entries to the localStore which will go in localStorage.
'EV_LOCALSTORE_PUT': true, 'EV_LOCALSTORE_PUT': true,

@ -176,7 +176,8 @@ define([
$(removeHistory).click(function () { $(removeHistory).click(function () {
UI.confirm(Messages.contacts_confirmRemoveHistory, function (yes) { UI.confirm(Messages.contacts_confirmRemoveHistory, function (yes) {
if (!yes) { return; } if (!yes) { return; }
Cryptpad.clearOwnedChannel(data.channel, function (e) {
messenger.clearOwnedChannel(data.channel, function (e) {
if (e) { if (e) {
console.error(e); console.error(e);
UI.alert(Messages.contacts_removeHistoryServerError); UI.alert(Messages.contacts_removeHistoryServerError);

Loading…
Cancel
Save