Fix bug chat history not deleted
parent
e52acda334
commit
f6cc3aa8c3
|
@ -943,6 +943,16 @@ define([
|
|||
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 () {
|
||||
emit('DISCONNECT');
|
||||
});
|
||||
|
@ -1000,6 +1010,9 @@ define([
|
|||
if (cmd === 'SET_CHANNEL_HEAD') {
|
||||
return void setChannelHead(data.id, data.sig, cb);
|
||||
}
|
||||
if (cmd === 'CLEAR_OWNED_CHANNEL') {
|
||||
return void clearOwnedChannel(data, cb);
|
||||
}
|
||||
};
|
||||
|
||||
Object.freeze(messenger);
|
||||
|
|
|
@ -291,13 +291,12 @@ define([
|
|||
UI.confirm(Messages.contacts_confirmRemoveHistory, function (yes) {
|
||||
if (!yes) { return; }
|
||||
|
||||
sframeChan.query('Q_CLEAR_OWNED_CHANNEL', id, function (e) {
|
||||
execCommand('CLEAR_OWNED_CHANNEL', id, function (e) {
|
||||
if (e) {
|
||||
console.error(e);
|
||||
UI.alert(Messages.contacts_removeHistoryServerError);
|
||||
return;
|
||||
}
|
||||
clearChannel(id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -152,13 +152,9 @@ define([
|
|||
if (typeof(channel) !== 'string' || channel.length !== 32) {
|
||||
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 (response && response.length) {
|
||||
cb(void 0, response[0]);
|
||||
} else {
|
||||
cb('INVALID_RESPONSE');
|
||||
}
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue