From dfadf3cceedd0b357ca7d1ee7f3a3e1c565588ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Fri, 26 Jul 2024 17:42:17 +0200 Subject: [PATCH] fix(Tinebase) recordchange event in popup windows --- tine20/Tinebase/js/broadcastClient.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tine20/Tinebase/js/broadcastClient.js b/tine20/Tinebase/js/broadcastClient.js index 036f3dd6201..c6064849900 100644 --- a/tine20/Tinebase/js/broadcastClient.js +++ b/tine20/Tinebase/js/broadcastClient.js @@ -84,7 +84,14 @@ const init = async () => { const topicPrefix = String(data.model).replace('_Model_', '.'); const topics = [`${topicPrefix}.*`, `${topicPrefix}.${data.recordId}`]; - if (topics.filter(value => postal.subscriptions.recordchange.hasOwnProperty(value)).length) { + // NOTE: postal.subscriptions are per window, we run in main window only! + let subscriptions = Object.keys(postal.subscriptions.recordchange) || []; + Ext.ux.PopupWindowMgr.each((win) => { + if (_.isObject(_.get(win, 'popup.postal.subscriptions.recordchange'))) { + subscriptions = _.uniq(subscriptions.concat(Object.keys(win.popup.postal.subscriptions.recordchange) || [])) + } + }); + if (topics.filter(value => subscriptions.indexOf(value) >= 0)) { if (! await isOwnEvent(data)) { handleEvent(data); }