Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an implementation of MSC2762: send/receive events #9

Merged
merged 2 commits into from
Nov 12, 2020

Conversation

turt2live
Copy link
Member

MSC: matrix-org/matrix-spec-proposals#2762

The capabilities introduced by MSC2762 are a bit annoying to parse and handle, so they spawned a utility class in this PR. The utility class just makes the code a bit clearer and easier to follow, at the risk of added complexity.

Documentation is intentionally left for a later PR. Tests would be nice, however none of the widget-api has tests at the moment :(

@turt2live turt2live requested a review from a team November 3, 2020 04:26
turt2live added a commit to matrix-org/matrix-react-sdk that referenced this pull request Nov 3, 2020
Part of MSC2762: matrix-org/matrix-spec-proposals#2762
Requires: matrix-org/matrix-widget-api#9

This is the bare minimum required to send an event to a widget and receive events from widgets. Like the view_room action, this is controlled by a well-known permission key.

**Danger**: This allows widgets to potentially modify room state. Use the permissions with care.
@dbkr dbkr self-assigned this Nov 11, 2020
return this.transport.send<ISendEventToWidgetRequestData>(
WidgetApiToWidgetAction.SendEvent,
rawEvent as ISendEventToWidgetRequestData, // it's compatible, but missing the index signature
).then();
Copy link
Member

Choose a reason for hiding this comment

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

unintentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a conversion because using async is hard and the types are a bit strong.

src/models/WidgetEventCapability.ts Show resolved Hide resolved
src/ClientWidgetApi.ts Outdated Show resolved Hide resolved
@turt2live turt2live requested a review from dbkr November 12, 2020 17:31
@turt2live turt2live merged commit 31c4435 into master Nov 12, 2020
@turt2live turt2live deleted the travis/msc-send-widget-events branch November 12, 2020 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants