Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add customisation point for declaring widget variables #6455

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

turt2live
Copy link
Member

Fixes element-hq/element-web#18035 (indirectly; issue is on a non-standard version of Element).

This has an isReady() step because the variable usage code path cannot be made async, so instead we let the async loading state happen in the prepare() stage. This is required for the intended usecase.


Tested with the following implementation:

class TestImpl implements IWidgetVariablesCustomisations {
    private promise = new LazyValue<void>(() => new Promise<void>(resolve => {
        setTimeout(() => {
            console.log("@@ RESOLVE");
            resolve();
        }, 10000);
    }));

    provideVariables(): Partial<Omit<ITemplateParams, "widgetRoomId">> {
        return {
            userDisplayName: "OVERRIDE",
        };
    }

    isReady(): Promise<void> {
        return this.promise.value;
    }
}

Notes: Add customisation point to override widget variables
element-web notes: none

Fixes element-hq/element-web#18035 (indirectly; issue is on a non-standard version of Element).

This has an isReady() step because the variable usage code path cannot be made async, so instead we let the async loading state happen in the prepare() stage. This is required for the intended usecase.
@turt2live turt2live added Sponsored T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements labels Jul 22, 2021
@turt2live turt2live requested a review from a team July 22, 2021 21:48
Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I can imagine other use cases might need the customisation to know more about the widget via an argument, but anyway that can be added later if needed.

@turt2live
Copy link
Member Author

Maybe we can fix that when we take out the words "stop gap". Though optimism is wearing thin there...

@turt2live turt2live merged commit b8781b7 into develop Jul 28, 2021
@turt2live turt2live deleted the travis/widget-customisation branch July 28, 2021 13:15
BBaoVanC added a commit to boba-best/element.boba.best that referenced this pull request Aug 13, 2021
* Show how long a call was on call tiles ([\element-hq#6570](matrix-org/matrix-react-sdk#6570)). Fixes element-hq#18405. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Add regional indicators to emoji picker ([\element-hq#6490](matrix-org/matrix-react-sdk#6490)). Fixes element-hq#14963. Contributed by [robintown](https://github.com/robintown).
* Make call control buttons accessible to screen reader users ([\element-hq#6181](matrix-org/matrix-react-sdk#6181)). Fixes element-hq#18358. Contributed by [pvagner](https://github.com/pvagner).
* Skip sending a thumbnail if it is not a sufficient saving over the original ([\element-hq#6559](matrix-org/matrix-react-sdk#6559)). Fixes element-hq#17906.
* Increase PiP snapping speed ([\element-hq#6539](matrix-org/matrix-react-sdk#6539)). Fixes element-hq#18371. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Improve and move the incoming call toast ([\element-hq#6470](matrix-org/matrix-react-sdk#6470)). Fixes element-hq#17912. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Allow all of the URL schemes that Firefox allows ([\element-hq#6457](matrix-org/matrix-react-sdk#6457)). Contributed by [aaronraimist](https://github.com/aaronraimist).
* Improve bubble layout colors ([\element-hq#6452](matrix-org/matrix-react-sdk#6452)). Fixes element-hq#18081. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Spaces let users switch between Home and All Rooms behaviours ([\element-hq#6497](matrix-org/matrix-react-sdk#6497)). Fixes element-hq#18093.
* Support for MSC2285 (hidden read receipts) ([\element-hq#6390](matrix-org/matrix-react-sdk#6390)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Group pinned message events with MELS ([\element-hq#6349](matrix-org/matrix-react-sdk#6349)). Fixes element-hq#17938. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Make version copiable ([\element-hq#6227](matrix-org/matrix-react-sdk#6227)). Fixes element-hq#17603 and element-hq#18329. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Improve voice messages uploading state ([\element-hq#6530](matrix-org/matrix-react-sdk#6530)). Fixes element-hq#18226 and element-hq#18224.
* Add surround with feature ([\element-hq#5510](matrix-org/matrix-react-sdk#5510)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Improve call event tile wording ([\element-hq#6545](matrix-org/matrix-react-sdk#6545)). Fixes element-hq#18376. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Show an avatar/a turned off microphone icon for muted users ([\element-hq#6486](matrix-org/matrix-react-sdk#6486)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Prompt user to leave rooms/subspaces in a space when leaving space ([\element-hq#6424](matrix-org/matrix-react-sdk#6424)). Fixes element-hq#18071.
* none ([\element-hq#6455](matrix-org/matrix-react-sdk#6455)). Fixes element-hq#18035.
* Add support for screen sharing in 1:1 calls ([\element-hq#5992](matrix-org/matrix-react-sdk#5992)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Dismiss electron download toast when clicking Open ([\element-hq#18267](element-hq#18267)). Fixes element-hq#18266.
* Fix [object Object] in Widget Permissions ([\element-hq#6560](matrix-org/matrix-react-sdk#6560)). Fixes element-hq#18384. Contributed by [Palid](https://github.com/Palid).
* Fix right margin for events on IRC layout ([\element-hq#6542](matrix-org/matrix-react-sdk#6542)). Fixes element-hq#18354.
* Mirror only usermedia feeds ([\element-hq#6512](matrix-org/matrix-react-sdk#6512)). Fixes element-hq#5633. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix LogoutDialog warning + TypeScript migration ([\element-hq#6533](matrix-org/matrix-react-sdk#6533)).
* Fix the wrong font being used in the room topic field ([\element-hq#6527](matrix-org/matrix-react-sdk#6527)). Fixes element-hq#18339. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix inconsistent styling for links on hover ([\element-hq#6513](matrix-org/matrix-react-sdk#6513)). Contributed by [janogarcia](https://github.com/janogarcia).
* Fix incorrect height for encoded placeholder images ([\element-hq#6514](matrix-org/matrix-react-sdk#6514)). Contributed by [Palid](https://github.com/Palid).
* Fix call events layout for message bubble ([\element-hq#6465](matrix-org/matrix-react-sdk#6465)). Fixes element-hq#18144.
* Improve subspaces and some utilities around room/space creation ([\element-hq#6458](matrix-org/matrix-react-sdk#6458)). Fixes element-hq#18090 element-hq#18091 and element-hq#17256.
* Restore pointer cursor for SenderProfile in message bubbles ([\element-hq#6501](matrix-org/matrix-react-sdk#6501)). Fixes element-hq#18249.
* Fix issues with the Call View ([\element-hq#6472](matrix-org/matrix-react-sdk#6472)). Fixes element-hq#18221. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Align event list summary read receipts when using message bubbles ([\element-hq#6500](matrix-org/matrix-react-sdk#6500)). Fixes element-hq#18143.
* Better positioning for unbubbled events in timeline ([\element-hq#6477](matrix-org/matrix-react-sdk#6477)). Fixes element-hq#18132.
* Realign reactions row with messages in modern layout ([\element-hq#6491](matrix-org/matrix-react-sdk#6491)). Fixes element-hq#18118. Contributed by [robintown](https://github.com/robintown).
* Fix CreateRoomDialog exploding when making public room outside of a space ([\element-hq#6492](matrix-org/matrix-react-sdk#6492)). Fixes element-hq#18275.
* Fix call crashing because `element` was undefined ([\element-hq#6488](matrix-org/matrix-react-sdk#6488)). Fixes element-hq#18270. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Upscale thumbnails to the container size ([\element-hq#6589](matrix-org/matrix-react-sdk#6589)). Fixes element-hq#18307.
* Fix create room dialog in spaces no longer adding to the space ([\element-hq#6587](matrix-org/matrix-react-sdk#6587)). Fixes element-hq#18465.
* Don't show a modal on call reject/user hangup ([\element-hq#6580](matrix-org/matrix-react-sdk#6580)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fade Call View Buttons after `componentDidMount` ([\element-hq#6581](matrix-org/matrix-react-sdk#6581)). Fixes element-hq#18439. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix missing expand button on codeblocks ([\element-hq#6565](matrix-org/matrix-react-sdk#6565)). Fixes element-hq#18388. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* allow customizing the bubble layout colors ([\element-hq#6568](matrix-org/matrix-react-sdk#6568)). Fixes element-hq#18408. Contributed by [benneti](https://github.com/benneti).
* Don't flash "Missed call" when accepting a call ([\element-hq#6567](matrix-org/matrix-react-sdk#6567)). Fixes element-hq#18404. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix clicking whitespaces on replies ([\element-hq#6571](matrix-org/matrix-react-sdk#6571)). Fixes element-hq#18327. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix composer not being disabled when sending voice messages ([\element-hq#6562](matrix-org/matrix-react-sdk#6562)). Fixes element-hq#18413.
* none ([\element-hq#6550](matrix-org/matrix-react-sdk#6550)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix sizing issues of the screen picker ([\element-hq#6498](matrix-org/matrix-react-sdk#6498)). Fixes element-hq#18281. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Stop voice messages that are playing when starting a recording ([\element-hq#6563](matrix-org/matrix-react-sdk#6563)). Fixes element-hq#18410.
* Fix random box appearing when clicking room list headers. ([\element-hq#6561](matrix-org/matrix-react-sdk#6561)). Fixes element-hq#18414.
* Null guard space inviter to prevent the app exploding ([\element-hq#6558](matrix-org/matrix-react-sdk#6558)).
* Make the ringing sound mutable/disablable ([\element-hq#6534](matrix-org/matrix-react-sdk#6534)). Fixes element-hq#15591. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix wrong cursor being used in PiP ([\element-hq#6551](matrix-org/matrix-react-sdk#6551)). Fixes element-hq#18383. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Re-pin Jitsi if the widget already exists ([\element-hq#6226](matrix-org/matrix-react-sdk#6226)). Fixes element-hq#17679. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix broken call notification regression ([\element-hq#6526](matrix-org/matrix-react-sdk#6526)). Fixes element-hq#18335. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* createRoom, only send join rule event if we have a join rule to put in it ([\element-hq#6516](matrix-org/matrix-react-sdk#6516)). Fixes element-hq#18301.
* Fix clicking pills inside replies ([\element-hq#6508](matrix-org/matrix-react-sdk#6508)). Fixes element-hq#18283. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix grecaptcha regression ([\element-hq#6503](matrix-org/matrix-react-sdk#6503)). Fixes element-hq#18284. Contributed by [Palid](https://github.com/Palid).
* Fix compatibility with accounts where the security passphrase was created on a mobile device ([\element-hq#1819](matrix-org/matrix-js-sdk#1819)).
chayleaf added a commit to chayleaf/matrix-react-sdk that referenced this pull request Aug 17, 2021
* Show how long a call was on call tiles ([\matrix-org#6570](matrix-org#6570)). Fixes element-hq/element-web#18405. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Add regional indicators to emoji picker ([\matrix-org#6490](matrix-org#6490)). Fixes element-hq/element-web#14963. Contributed by [robintown](https://github.com/robintown).
* Make call control buttons accessible to screen reader users ([\matrix-org#6181](matrix-org#6181)). Fixes element-hq/element-web#18358. Contributed by [pvagner](https://github.com/pvagner).
* Skip sending a thumbnail if it is not a sufficient saving over the original ([\matrix-org#6559](matrix-org#6559)). Fixes element-hq/element-web#17906.
* Increase PiP snapping speed ([\matrix-org#6539](matrix-org#6539)). Fixes element-hq/element-web#18371. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Improve and move the incoming call toast ([\matrix-org#6470](matrix-org#6470)). Fixes element-hq/element-web#17912. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Allow all of the URL schemes that Firefox allows ([\matrix-org#6457](matrix-org#6457)). Contributed by [aaronraimist](https://github.com/aaronraimist).
* Improve bubble layout colors ([\matrix-org#6452](matrix-org#6452)). Fixes element-hq/element-web#18081. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Spaces let users switch between Home and All Rooms behaviours ([\matrix-org#6497](matrix-org#6497)). Fixes element-hq/element-web#18093.
* Support for MSC2285 (hidden read receipts) ([\matrix-org#6390](matrix-org#6390)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Group pinned message events with MELS ([\matrix-org#6349](matrix-org#6349)). Fixes element-hq/element-web#17938. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Make version copiable ([\matrix-org#6227](matrix-org#6227)). Fixes element-hq/element-web#17603 and element-hq/element-web#18329. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Improve voice messages uploading state ([\matrix-org#6530](matrix-org#6530)). Fixes element-hq/element-web#18226 and element-hq/element-web#18224.
* Add surround with feature ([\matrix-org#5510](matrix-org#5510)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Improve call event tile wording ([\matrix-org#6545](matrix-org#6545)). Fixes element-hq/element-web#18376. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Show an avatar/a turned off microphone icon for muted users ([\matrix-org#6486](matrix-org#6486)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Prompt user to leave rooms/subspaces in a space when leaving space ([\matrix-org#6424](matrix-org#6424)). Fixes element-hq/element-web#18071.
* Add customisation point to override widget variables ([\matrix-org#6455](matrix-org#6455)). Fixes element-hq/element-web#18035.
* Add support for screen sharing in 1:1 calls ([\matrix-org#5992](matrix-org#5992)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* [Release] Fix glare related regressions ([\matrix-org#6622](matrix-org#6622)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* [Release] Fix PiP of held calls ([\matrix-org#6612](matrix-org#6612)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* [Release] Fix toast colors ([\matrix-org#6607](matrix-org#6607)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix [object Object] in Widget Permissions ([\matrix-org#6560](matrix-org#6560)). Fixes element-hq/element-web#18384. Contributed by [Palid](https://github.com/Palid).
* Fix right margin for events on IRC layout ([\matrix-org#6542](matrix-org#6542)). Fixes element-hq/element-web#18354.
* Mirror only usermedia feeds ([\matrix-org#6512](matrix-org#6512)). Fixes element-hq/element-web#5633. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix LogoutDialog warning + TypeScript migration ([\matrix-org#6533](matrix-org#6533)).
* Fix the wrong font being used in the room topic field ([\matrix-org#6527](matrix-org#6527)). Fixes element-hq/element-web#18339. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix inconsistent styling for links on hover ([\matrix-org#6513](matrix-org#6513)). Contributed by [janogarcia](https://github.com/janogarcia).
* Fix incorrect height for encoded placeholder images ([\matrix-org#6514](matrix-org#6514)). Contributed by [Palid](https://github.com/Palid).
* Fix call events layout for message bubble ([\matrix-org#6465](matrix-org#6465)). Fixes element-hq/element-web#18144.
* Improve subspaces and some utilities around room/space creation ([\matrix-org#6458](matrix-org#6458)). Fixes element-hq/element-web#18090 element-hq/element-web#18091 and element-hq/element-web#17256.
* Restore pointer cursor for SenderProfile in message bubbles ([\matrix-org#6501](matrix-org#6501)). Fixes element-hq/element-web#18249.
* Fix issues with the Call View ([\matrix-org#6472](matrix-org#6472)). Fixes element-hq/element-web#18221. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Align event list summary read receipts when using message bubbles ([\matrix-org#6500](matrix-org#6500)). Fixes element-hq/element-web#18143.
* Better positioning for unbubbled events in timeline ([\matrix-org#6477](matrix-org#6477)). Fixes element-hq/element-web#18132.
* Realign reactions row with messages in modern layout ([\matrix-org#6491](matrix-org#6491)). Fixes element-hq/element-web#18118. Contributed by [robintown](https://github.com/robintown).
* Fix CreateRoomDialog exploding when making public room outside of a space ([\matrix-org#6492](matrix-org#6492)). Fixes element-hq/element-web#18275.
* Fix call crashing because `element` was undefined ([\matrix-org#6488](matrix-org#6488)). Fixes element-hq/element-web#18270. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Upscale thumbnails to the container size ([\matrix-org#6589](matrix-org#6589)). Fixes element-hq/element-web#18307.
* Fix create room dialog in spaces no longer adding to the space ([\matrix-org#6587](matrix-org#6587)). Fixes element-hq/element-web#18465.
* Don't show a modal on call reject/user hangup ([\matrix-org#6580](matrix-org#6580)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fade Call View Buttons after `componentDidMount` ([\matrix-org#6581](matrix-org#6581)). Fixes element-hq/element-web#18439. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix missing expand button on codeblocks ([\matrix-org#6565](matrix-org#6565)). Fixes element-hq/element-web#18388. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* allow customizing the bubble layout colors ([\matrix-org#6568](matrix-org#6568)). Fixes element-hq/element-web#18408. Contributed by [benneti](https://github.com/benneti).
* Don't flash "Missed call" when accepting a call ([\matrix-org#6567](matrix-org#6567)). Fixes element-hq/element-web#18404. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix clicking whitespaces on replies ([\matrix-org#6571](matrix-org#6571)). Fixes element-hq/element-web#18327. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix disabled state for voice messages + send button tooltip ([\matrix-org#6562](matrix-org#6562)). Fixes element-hq/element-web#18413.
* Fix voice feed being cut-off ([\matrix-org#6550](matrix-org#6550)). Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix sizing issues of the screen picker ([\matrix-org#6498](matrix-org#6498)). Fixes element-hq/element-web#18281. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Stop voice messages that are playing when starting a recording ([\matrix-org#6563](matrix-org#6563)). Fixes element-hq/element-web#18410.
* Properly set style attribute on shared usercontent iframe ([\matrix-org#6561](matrix-org#6561)). Fixes element-hq/element-web#18414.
* Null guard space inviter to prevent the app exploding ([\matrix-org#6558](matrix-org#6558)).
* Make the ringing sound mutable/disablable ([\matrix-org#6534](matrix-org#6534)). Fixes element-hq/element-web#15591. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix wrong cursor being used in PiP ([\matrix-org#6551](matrix-org#6551)). Fixes element-hq/element-web#18383. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Re-pin Jitsi if the widget already exists ([\matrix-org#6226](matrix-org#6226)). Fixes element-hq/element-web#17679. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix broken call notification regression ([\matrix-org#6526](matrix-org#6526)). Fixes element-hq/element-web#18335. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* createRoom, only send join rule event if we have a join rule to put in it ([\matrix-org#6516](matrix-org#6516)). Fixes element-hq/element-web#18301.
* Fix clicking pills inside replies ([\matrix-org#6508](matrix-org#6508)). Fixes element-hq/element-web#18283. Contributed by [SimonBrandner](https://github.com/SimonBrandner).
* Fix grecaptcha regression ([\matrix-org#6503](matrix-org#6503)). Fixes element-hq/element-web#18284. Contributed by [Palid](https://github.com/Palid).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Sponsored T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display name in Jitsi is wrong if the display name isn't yet loaded
2 participants