Only clear messages when clear_messages_on_reconnection
is true
This commit is contained in:
parent
c038794fb5
commit
c7b6bb4773
@ -420,9 +420,9 @@
|
||||
}));
|
||||
});
|
||||
|
||||
it("clears cached messages when it gets closed",
|
||||
it("clears cached messages when it gets closed and clear_messages_on_reconnection is true",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
null, ['rosterGroupsFetched'], {'clear_messages_on_reconnection': true},
|
||||
async function (done, _converse) {
|
||||
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
|
@ -301,9 +301,9 @@ converse.plugins.add('converse-chatboxes', {
|
||||
|
||||
initMessages () {
|
||||
this.messages = new this.messagesCollection();
|
||||
this.messages.browserStorage = new BrowserStorage.session(this.getMessagesCacheKey());
|
||||
const storage = _converse.config.get('storage');
|
||||
this.messages.browserStorage = new BrowserStorage[storage](this.getMessagesCacheKey());
|
||||
this.messages.chatbox = this;
|
||||
|
||||
this.messages.on('change:upload', (message) => {
|
||||
if (message.get('upload') === _converse.SUCCESS) {
|
||||
_converse.api.send(this.createMessageStanza(message));
|
||||
@ -349,8 +349,10 @@ converse.plugins.add('converse-chatboxes', {
|
||||
} catch (e) {
|
||||
_converse.log(e, Strophe.LogLevel.ERROR);
|
||||
} finally {
|
||||
if (_converse.clear_messages_on_reconnection) {
|
||||
this.clearMessages();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
announceReconnection () {
|
||||
|
Loading…
Reference in New Issue
Block a user