From 17a04f2915ed2bb5caa755f8f55fdd61d8f37b05 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 6 Oct 2020 10:48:55 +0100 Subject: [PATCH] Fix naive pinning limit and app tile widgetMessaging NPE Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/AppTile.js | 4 ++-- src/stores/WidgetStore.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 3945eaa763..3405d4ff16 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -563,8 +563,8 @@ export default class AppTile extends React.Component { const canUserModify = this._canUserModify(); const showEditButton = Boolean(this._sgWidget.isManagedByManager && canUserModify); const showDeleteButton = (this.props.showDelete === undefined || this.props.showDelete) && canUserModify; - const showPictureSnapshotButton = this._sgWidget.widgetApi.hasCapability(MatrixCapabilities.Screenshots) - && this.props.show; + const showPictureSnapshotButton = this.props.show && this._sgWidget.widgetApi && + this._sgWidget.widgetApi.hasCapability(MatrixCapabilities.Screenshots); const WidgetContextMenu = sdk.getComponent('views.context_menus.WidgetContextMenu'); contextMenu = ( diff --git a/src/stores/WidgetStore.ts b/src/stores/WidgetStore.ts index dd20b7576f..d9cbdec76d 100644 --- a/src/stores/WidgetStore.ts +++ b/src/stores/WidgetStore.ts @@ -171,7 +171,7 @@ export default class WidgetStore extends AsyncStoreWithClient { const roomId = this.getRoomId(widgetId); const roomInfo = this.getRoom(roomId); return roomInfo && Object.keys(roomInfo.pinned).filter(k => { - return roomInfo.widgets.some(app => app.id === k); + return roomInfo.pinned[k] && roomInfo.widgets.some(app => app.id === k); }).length < 2; }