Commit 53ced8c7 authored by JC Brand's avatar JC Brand

muc: Don't restore messages from cache...

if we're just going to clear them again

This avoids flashing of messages followed by a spinner.
parent a8cfc12f
...@@ -4,22 +4,20 @@ ...@@ -4,22 +4,20 @@
- Add support for [XEP-0424 Message Retraction](http://localhost:3080/extensions/xep-0424.html) - Add support for [XEP-0424 Message Retraction](http://localhost:3080/extensions/xep-0424.html)
- Add support for [XEP-0425 Message Moderation](http://localhost:3080/extensions/xep-0425.html) - Add support for [XEP-0425 Message Moderation](http://localhost:3080/extensions/xep-0425.html)
- Prevent editing of sent file uploads.
- Initial support for sending custom emojis. Currently only between Converse
instances. Still working out a wire protocol for compatibility with other clients.
To add custom emojis, edit the `emojis.json` file.
- Refactor some presence and status handling code from `converse-core` into `@converse/headless/converse-status`. - Refactor some presence and status handling code from `converse-core` into `@converse/headless/converse-status`.
- New API [\_converse.api.headlines](https://conversejs.org/docs/html/api/-_converse.api.headlines.html#.get) - New API [\_converse.api.headlines](https://conversejs.org/docs/html/api/-_converse.api.headlines.html#.get)
- New config option [allow_message_retraction](https://conversejs.org/docs/html/configuration.html#allow-message-retraction) - New config option [allow_message_retraction](https://conversejs.org/docs/html/configuration.html#allow-message-retraction)
- New config option [muc-show-logs-before-join](https://conversejs.org/docs/html/configuration.html#muc-show-logs-before-join) - New config option [muc-show-logs-before-join](https://conversejs.org/docs/html/configuration.html#muc-show-logs-before-join)
_ New config option [muc_mention_autocomplete_filter](https://conversejs.org/docs/html/configuration.html#muc_mention_autocomplete_filter) - New config option [muc_mention_autocomplete_filter](https://conversejs.org/docs/html/configuration.html#muc_mention_autocomplete_filter)
_ New config option [muc_mention_autocomplete_show_avatar](https://conversejs.org/docs/html/configuration.html#muc_mention_autocomplete_show_avatar) - New config option [muc_mention_autocomplete_show_avatar](https://conversejs.org/docs/html/configuration.html#muc_mention_autocomplete_show_avatar)
- Initial support for sending custom emojis. Currently only between Converse
instances. Still working out a wire protocol for compatibility with other clients.
To add custom emojis, edit the `emojis.json` file.
- #129: Add support for XEP-0156: Disovering Alternative XMPP Connection Methods. Only XML is supported for now. - #129: Add support for [XEP-0156: Disovering Alternative XMPP Connection Methods](https://xmpp.org/extensions/xep-0156.html). Only XML is supported for now.
- #1105: Preliminary support for storing persistent data in IndexedDB instead of localStorage - #1105: Preliminary support for storing persistent data in IndexedDB instead of localStorage
- #1691: Fix `collection.chatbox is undefined` errors - #1691: Fix `collection.chatbox is undefined` errors
- #1733: New message notifications for a minimized chat stack on top of each other
- #1757: Chats are hidden behind the controlbox on mobile
- #1772 `_converse.api.contact.add(jid, nick)` fails, says not a function - #1772 `_converse.api.contact.add(jid, nick)` fails, says not a function
### Breaking changes ### Breaking changes
......
...@@ -390,7 +390,6 @@ converse.plugins.add('converse-muc', { ...@@ -390,7 +390,6 @@ converse.plugins.add('converse-muc', {
this.registerHandlers(); this.registerHandlers();
await this.initOccupants(); await this.initOccupants();
await this.fetchMessages();
this.enterRoom(); this.enterRoom();
this.initialized.resolve(); this.initialized.resolve();
}, },
...@@ -405,12 +404,13 @@ converse.plugins.add('converse-muc', { ...@@ -405,12 +404,13 @@ converse.plugins.add('converse-muc', {
async enterRoom () { async enterRoom () {
const conn_status = this.get('connection_status'); const conn_status = this.get('connection_status');
log.debug(`${this.get('jid')} initialized with connection_status ${conn_status}`);
if (conn_status !== converse.ROOMSTATUS.ENTERED) { if (conn_status !== converse.ROOMSTATUS.ENTERED) {
// We're not restoring a room from cache, so let's clear the potentially stale cache. // We're not restoring a room from cache, so let's clear the potentially stale cache.
this.removeNonMembers(); this.removeNonMembers();
await this.refreshRoomFeatures(); await this.refreshRoomFeatures();
if (_converse.clear_messages_on_reconnection) { if (_converse.muc_show_logs_before_join) {
await this.fetchMessages();
} else if (_converse.clear_messages_on_reconnection) {
await this.clearMessages(); await this.clearMessages();
} }
if (!u.isPersistableModel(this)) { if (!u.isPersistableModel(this)) {
...@@ -421,6 +421,7 @@ converse.plugins.add('converse-muc', { ...@@ -421,6 +421,7 @@ converse.plugins.add('converse-muc', {
this.join(); this.join();
} else if (!(await this.rejoinIfNecessary())) { } else if (!(await this.rejoinIfNecessary())) {
// We've restored the room from cache and we're still joined. // We've restored the room from cache and we're still joined.
await this.fetchMessages();
this.features.fetch(); this.features.fetch();
} }
}, },
......
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