From c0c8fbac38bc827c8a436a6f96dabe4785479784 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 13 May 2021 12:15:39 +0200 Subject: [PATCH] Wrongly passed data to the context parameter in hook Causes `undefined` to be returned from `constructPresence` when `converse-caps` is not enabled --- src/headless/plugins/caps/index.js | 2 +- src/headless/plugins/status/status.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/headless/plugins/caps/index.js b/src/headless/plugins/caps/index.js index cf07aa3b1..f4cf9352c 100644 --- a/src/headless/plugins/caps/index.js +++ b/src/headless/plugins/caps/index.js @@ -15,6 +15,6 @@ converse.plugins.add('converse-caps', { dependencies: ['converse-status'], initialize () { - api.listen.on('constructedPresence', p => (p.root().cnode(createCapsNode()).up() && p)); + api.listen.on('constructedPresence', (_, p) => (p.root().cnode(createCapsNode()).up() && p)); } }); diff --git a/src/headless/plugins/status/status.js b/src/headless/plugins/status/status.js index 854037b11..cfbe0e185 100644 --- a/src/headless/plugins/status/status.js +++ b/src/headless/plugins/status/status.js @@ -64,7 +64,7 @@ const XMPPStatus = Model.extend({ idle_since.setSeconds(idle_since.getSeconds() - _converse.idle_seconds); presence.c('idle', {xmlns: Strophe.NS.IDLE, since: idle_since.toISOString()}); } - presence = await _converse.api.hook('constructedPresence', presence); + presence = await api.hook('constructedPresence', null, presence); return presence; } });