Commit 0426898c authored by JC Brand's avatar JC Brand

Store chat messages in sessionStorage

so that they're cleared when the last tab closes
parent 7950f7c2
...@@ -293,7 +293,7 @@ converse.plugins.add('converse-chatboxes', { ...@@ -293,7 +293,7 @@ converse.plugins.add('converse-chatboxes', {
initMessages () { initMessages () {
this.messages = new _converse.Messages(); this.messages = new _converse.Messages();
const storage = _converse.config.get('storage'); const storage = _converse.config.get('storage');
this.messages.browserStorage = new Backbone.BrowserStorage[storage]( this.messages.browserStorage = new Backbone.BrowserStorage.session(
`converse.messages-${this.get('jid')}-${_converse.bare_jid}`); `converse.messages-${this.get('jid')}-${_converse.bare_jid}`);
this.messages.chatbox = this; this.messages.chatbox = this;
......
...@@ -1485,7 +1485,7 @@ converse.plugins.add('converse-muc', { ...@@ -1485,7 +1485,7 @@ converse.plugins.add('converse-muc', {
* disconnected, so that they will be properly entered again * disconnected, so that they will be properly entered again
* when fetched from session storage. * when fetched from session storage.
*/ */
_converse.chatboxes.each(function (model) { _converse.chatboxes.each(model => {
if (model.get('type') === _converse.CHATROOMS_TYPE) { if (model.get('type') === _converse.CHATROOMS_TYPE) {
model.save('connection_status', converse.ROOMSTATUS.DISCONNECTED); model.save('connection_status', converse.ROOMSTATUS.DISCONNECTED);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment