From bb60f8cff4d60fd1c776a63b6b9f4433620d69ac Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 18 Jun 2021 10:21:03 +0200 Subject: [PATCH] Move trigger out of while loop --- src/headless/shared/chat/utils.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/headless/shared/chat/utils.js b/src/headless/shared/chat/utils.js index ab95f1ed3..b59a89979 100644 --- a/src/headless/shared/chat/utils.js +++ b/src/headless/shared/chat/utils.js @@ -11,16 +11,16 @@ export function pruneHistory (model) { if (non_empty_messages.length > max_history) { while (non_empty_messages.length > max_history) { non_empty_messages.shift().destroy(); - /** - * Triggered once the message history has been pruned, i.e. - * once older messages have been removed to keep the - * number of messages below the value set in `prune_messages_above`. - * @event _converse#historyPruned - * @type { _converse.ChatBox | _converse.ChatRoom } - * @example _converse.api.listen.on('historyPruned', this => { ... }); - */ - api.trigger('historyPruned', model); } + /** + * Triggered once the message history has been pruned, i.e. + * once older messages have been removed to keep the + * number of messages below the value set in `prune_messages_above`. + * @event _converse#historyPruned + * @type { _converse.ChatBox | _converse.ChatRoom } + * @example _converse.api.listen.on('historyPruned', this => { ... }); + */ + api.trigger('historyPruned', model); } } }