Clear message cache when closing a MUC

This commit is contained in:
JC Brand 2020-12-11 13:57:16 +01:00
parent 3b00a0e30d
commit 14c9b2f4ae
4 changed files with 18 additions and 2 deletions

View File

@ -9,10 +9,13 @@
- New hook: [getMessageActionButtons](https://conversejs.org/docs/html/api/-_converse.html#event:getMessageActionButtons)
- File structure reordering: All plugins are now in `./plugins` folders.
- New configuration setting: [show_tab_notifications](https://conversejs.org/docs/html/configuration.html#show-tab-notifications)
- New configuration setting: [muc_clear_messages_on_leave](https://conversejs.org/docs/html/configuration.html#muc-clear-messages-on-leave)
### Breaking Changes
The [afterMessageBodyTransformed](https://conversejs.org/docs/html/api/-_converse.html#event:afterMessageBodyTransformed) and [beforeMessageBodyTransformed](https://conversejs.org/docs/html/api/-_converse.html#event:beforeMessageBodyTransformed) events now has a different signatures.
When leaving a MUC, the message history is deleted. This means that decrypted
OMEMO messages are gone and cannot be recovered on that device. See [muc_clear_messages_on_leave](https://conversejs.org/docs/html/configuration.html#muc-clear-messages-on-leave).
## 7.0.2 (2020-11-23)

View File

@ -1072,7 +1072,7 @@ VCard is taken, and if that is not set but `muc_nickname_from_jid`_ is set to
If no nickame value is found, then an error will be raised.
muc_hats
-------------------
--------
* Default: ``['xep317']``
@ -1197,6 +1197,16 @@ If all roles or all affiliations are disabled, then the relevant tab won't be
showed at all.
muc_clear_messages_on_leave
---------------------------
* Default: ``true``
Starting with Converse 8.0.0, when leaving a MUC, all cached messages in the history is cleared.
Note: This means that you lose your history of decrypted OMEMO messages and cannot recover it.
muc_disable_slash_commands
--------------------------
@ -1383,7 +1393,7 @@ muc_show_info_messages
----------------------
* Default: List composed of MUC status codes, role changes, join and leave events
and affiliation changes. The values of converse.MUC_INFO_CODES below are joined to
and affiliation changes. The values of converse.MUC_INFO_CODES below are joined to
build the default list:
.. code-block:: javascript

View File

@ -223,6 +223,7 @@ converse.plugins.add('converse-muc', {
'auto_register_muc_nickname': false,
'hide_muc_participants': false,
'locked_muc_domain': false,
'muc_clear_messages_on_leave': true,
'muc_domain': undefined,
'muc_fetch_members': true,
'muc_history_max_stanzas': undefined,

View File

@ -632,6 +632,8 @@ const ChatRoomMixin = {
async leave (exit_msg) {
this.features.destroy();
this.occupants.clearStore();
api.settings.get('muc_clear_messages_on_leave') && this.messages.clearStore();
if (_converse.disco_entities) {
const disco_entity = _converse.disco_entities.get(this.get('jid'));
if (disco_entity) {