Browse Source

Clear the conversation just before renewing it to prevent some events to be triggered

pull/1474/head
Timothée Jaussoin 2 weeks ago
parent
commit
add998bbea
  1. 9
      app/Widgets/Chat/Chat.php
  2. 10
      composer.lock

9
app/Widgets/Chat/Chat.php

@ -1012,8 +1012,7 @@ class Chat extends \Movim\Widget\Base
->first();
if ($contextMessage) {
$this->rpc('MovimTpl.fill', '#' . cleanupId($jid) . '-conversation', '');
$this->ajaxGetHistory($jid, $contextMessage->published, muc: $contextMessage->isMuc(), prepend: false, tryMam: false);
$this->ajaxGetHistory($jid, $contextMessage->published, muc: $contextMessage->isMuc(), prepend: false, tryMam: false, clear: true);
$this->rpc('Chat.scrollAndBlinkMessageMid', $mid);
$this->rpc('MovimUtils.addClass', '#chat_widget .contained', 'history');
}
@ -1025,7 +1024,7 @@ class Chat extends \Movim\Widget\Base
* @param string jid
* @param string time
*/
public function ajaxGetHistory(string $jid, ?string $date = null, bool $muc = false, bool $prepend = true, bool $tryMam = true)
public function ajaxGetHistory(string $jid, ?string $date = null, bool $muc = false, bool $prepend = true, bool $tryMam = true, ?bool $clear = false)
{
if (!validateJid($jid)) return;
@ -1049,6 +1048,10 @@ class Chat extends \Movim\Widget\Base
$this->prepareMessage($message);
}
if ($clear) {
$this->rpc('MovimTpl.fill', '#' . cleanupId($jid) . '-conversation', '');
}
$this->rpc('Chat.appendMessagesWrapper', $this->_wrapper, $prepend);
$this->_wrapper = [];
}

10
composer.lock

@ -2449,16 +2449,16 @@
},
{
"name": "laravel/serializable-closure",
"version": "v2.0.4",
"version": "v2.0.5",
"source": {
"type": "git",
"url": "https://github.com/laravel/serializable-closure.git",
"reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841"
"reference": "3832547db6e0e2f8bb03d4093857b378c66eceed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/b352cf0534aa1ae6b4d825d1e762e35d43f8a841",
"reference": "b352cf0534aa1ae6b4d825d1e762e35d43f8a841",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/3832547db6e0e2f8bb03d4093857b378c66eceed",
"reference": "3832547db6e0e2f8bb03d4093857b378c66eceed",
"shasum": ""
},
"require": {
@ -2506,7 +2506,7 @@
"issues": "https://github.com/laravel/serializable-closure/issues",
"source": "https://github.com/laravel/serializable-closure"
},
"time": "2025-03-19T13:51:03+00:00"
"time": "2025-09-22T17:29:40+00:00"
},
{
"name": "league/commonmark",

Loading…
Cancel
Save