diff options
author | Joas Schilling <coding@schilljs.com> | 2023-07-14 15:11:17 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-07-18 07:37:25 +0000 |
commit | 97e8cec6a029f0e2910f84aa654bdb5965f27e50 (patch) | |
tree | 59ff2eb042d4b73ae839cdbaf963f02f0e720f8e /src | |
parent | 1189f2c64de4deefda755b7a383f91ddcd382ac3 (diff) |
fix(status): Don't emit event when the user status did not update
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/store/conversationsStore.js | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js index 237575fb2..830c7dffd 100644 --- a/src/store/conversationsStore.js +++ b/src/store/conversationsStore.js @@ -240,13 +240,21 @@ const actions = { */ postAddConversation(context, conversation) { if (conversation.type === CONVERSATION.TYPE.ONE_TO_ONE && conversation.status) { - emit('user_status:status.updated', { - status: conversation.status, - message: conversation.statusMessage, - icon: conversation.statusIcon, - clearAt: conversation.statusClearAt, - userId: conversation.name, - }) + const prevStatus = context.state.conversations[conversation.token] || {} + + // Only emit the event when something actually changed + if (prevStatus?.status !== conversation.status + || prevStatus?.statusMessage !== conversation.statusMessage + || prevStatus?.statusIcon !== conversation.statusIcon + || prevStatus?.statusClearAt !== conversation.statusClearAt) { + emit('user_status:status.updated', { + status: conversation.status, + message: conversation.statusMessage, + icon: conversation.statusIcon, + clearAt: conversation.statusClearAt, + userId: conversation.name, + }) + } } let currentUser = { |