From bf6878e6c3e6213a03a055f933117bd52dc4b8ec Mon Sep 17 00:00:00 2001 From: Douglas Gubert Date: Tue, 4 Jan 2022 21:39:29 -0300 Subject: [PATCH] [FIX][APPS] Action buttons not removed when app is disabled or uninstalled (#24107) --- app/apps/client/communication/websockets.js | 2 +- app/ui-utils/client/lib/MessageAction.js | 4 ++++ package-lock.json | 6 +++--- package.json | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/apps/client/communication/websockets.js b/app/apps/client/communication/websockets.js index 50c5455e1cc0..090fb059edaf 100644 --- a/app/apps/client/communication/websockets.js +++ b/app/apps/client/communication/websockets.js @@ -38,7 +38,7 @@ export class AppWebsocketReceiver extends Emitter { this.streamer.on(AppEvents.COMMAND_UPDATED, this.onCommandAddedOrUpdated); this.streamer.on(AppEvents.COMMAND_REMOVED, this.onCommandRemovedOrDisabled); this.streamer.on(AppEvents.COMMAND_DISABLED, this.onCommandRemovedOrDisabled); - this.streamer.on(AppEvents.COMMAND_DISABLED, this.onActionsChanged); + this.streamer.on(AppEvents.ACTIONS_CHANGED, this.onActionsChanged); } registerListener(event, listener) { diff --git a/app/ui-utils/client/lib/MessageAction.js b/app/ui-utils/client/lib/MessageAction.js index aa3c58709f83..3a639d15ee21 100644 --- a/app/ui-utils/client/lib/MessageAction.js +++ b/app/ui-utils/client/lib/MessageAction.js @@ -70,6 +70,8 @@ export const MessageAction = new (class { return Tracker.nonreactive(() => { const btns = this.buttons.get(); delete btns[id]; + mem.clear(this._getButtons); + mem.clear(this._getButtonsByGroup); return this.buttons.set(btns); }); } @@ -79,6 +81,8 @@ export const MessageAction = new (class { const btns = this.buttons.get(); if (btns[id]) { btns[id] = _.extend(btns[id], config); + mem.clear(this._getButtons); + mem.clear(this._getButtonsByGroup); return this.buttons.set(btns); } }); diff --git a/package-lock.json b/package-lock.json index 9509ec2f8062..a536ff11e617 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5324,9 +5324,9 @@ } }, "@rocket.chat/apps-engine": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/@rocket.chat/apps-engine/-/apps-engine-1.29.0.tgz", - "integrity": "sha512-LEeOS87pESqA+/lOeUPNVS6QspSH/cYILsGI5t/uekUv80zvhrV5Lzd59CXM+RH1xVB/55y9V33OefwPNE/S9A==", + "version": "1.29.1", + "resolved": "https://registry.npmjs.org/@rocket.chat/apps-engine/-/apps-engine-1.29.1.tgz", + "integrity": "sha512-b4IXSvUCPnCSLvPGakuN6/xWyon8GIPYyYNTPgKKaCWnFeDbgFKjRidu8jxkNoRPjWiOINOEIWImrmve91LMKw==", "requires": { "adm-zip": "^0.4.9", "cryptiles": "^4.1.3", diff --git a/package.json b/package.json index 970ce5100045..1e434d6bcad5 100644 --- a/package.json +++ b/package.json @@ -174,7 +174,7 @@ "@nivo/heatmap": "0.73.0", "@nivo/line": "0.62.0", "@nivo/pie": "0.73.0", - "@rocket.chat/apps-engine": "^1.29.0", + "@rocket.chat/apps-engine": "^1.29.1", "@rocket.chat/css-in-js": "^0.31.0", "@rocket.chat/emitter": "^0.31.0", "@rocket.chat/fuselage": "^0.31.0",