From b5320444a905f51d410429353e81e70ed7c08fde Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 8 May 2018 22:05:53 +0100 Subject: [PATCH 1/3] Fix current user and creator user ID properties. --- src/components/views/rooms/Stickerpicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/Stickerpicker.js b/src/components/views/rooms/Stickerpicker.js index c055c67cd3..031f93c919 100644 --- a/src/components/views/rooms/Stickerpicker.js +++ b/src/components/views/rooms/Stickerpicker.js @@ -164,8 +164,8 @@ export default class Stickerpicker extends React.Component { room={this.props.room} type={stickerpickerWidget.content.type} fullWidth={true} - userId={stickerpickerWidget.sender || MatrixClientPeg.get().credentials.userId} - creatorUserId={MatrixClientPeg.get().credentials.userId} + userId={MatrixClientPeg.get().credentials.userId} + creatorUserId={stickerpickerWidget.sender || MatrixClientPeg.get().credentials.userId} waitForIframeLoad={true} show={true} showMenubar={true} From 8e1ba6d139253d88a21d4c9efe7a4711734750f7 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 8 May 2018 22:44:49 +0100 Subject: [PATCH 2/3] Always allow users to edit their user widgets. --- src/components/views/elements/AppTile.js | 8 ++++++++ src/components/views/rooms/Stickerpicker.js | 1 + 2 files changed, 9 insertions(+) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 007eb8126c..af754c7d4c 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -274,6 +274,11 @@ export default class AppTile extends React.Component { } _canUserModify() { + // User widgets should always be modifiable by their creator + if (this.props.userWidget && MatrixClientPeg.get().credentials.userId === this.props.creatorUserId) { + return true; + } + // Check if the current user can modify widgets in the current room return WidgetUtils.canUserModifyWidgets(this.props.room.roomId); } @@ -698,6 +703,8 @@ AppTile.propTypes = { // Optional function to be called on widget capability request // Called with an array of the requested capabilities onCapabilityRequest: PropTypes.func, + // Is this an instance of a user widget + userWidget: PropTypes.bool, }; AppTile.defaultProps = { @@ -710,4 +717,5 @@ AppTile.defaultProps = { showPopout: true, handleMinimisePointerEvents: false, whitelistCapabilities: [], + userWidget: false, }; diff --git a/src/components/views/rooms/Stickerpicker.js b/src/components/views/rooms/Stickerpicker.js index 031f93c919..9b489c3e38 100644 --- a/src/components/views/rooms/Stickerpicker.js +++ b/src/components/views/rooms/Stickerpicker.js @@ -178,6 +178,7 @@ export default class Stickerpicker extends React.Component { onMinimiseClick={this._onHideStickersClick} handleMinimisePointerEvents={true} whitelistCapabilities={['m.sticker']} + userWidget={true} />