Skip to content

widget: msc4407 push initial sticky map to widgets#5163

Closed
BillCarsonFr wants to merge 1 commit intodevelopfrom
valere/widget/msc4407_initial_sticky_state
Closed

widget: msc4407 push initial sticky map to widgets#5163
BillCarsonFr wants to merge 1 commit intodevelopfrom
valere/widget/msc4407_initial_sticky_state

Conversation

@BillCarsonFr
Copy link
Copy Markdown
Member

Depends on matrix-org/matrix-widget-api#161

Widgets have now the possibility to read sticky events.
When a widget is loaded it only gets access to the live sticky event, so it doesn't know about pre-existing sticky events.

This a bit similar than with state, when a widget is loaded it will receive an update of the current state.
This PR does the same for sticky events, the hosting client will push the current sticky states to the widget, so we need to add support for receiving such udpates.

When org.matrix.msc4407.initial_sticky_state is received the sticky events are parsed and injected in the room, to that the room view from the widget is up-to-date with the room from the host application.

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

Comment on lines +817 to +822
private onPushInitialStickyState = async (
ev: CustomEvent<IPushInitialStickyStateToWidgetActionRequest>,
): Promise<void> => {
ev.preventDefault();

const { roomId, stickyEvents } = ev.detail.data;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this whole function be part of onEvent?
We branch out based on if there is a sticky key in the event.
We would need that anyhow for updating on new incoming sticky events. They also need to be added with _unstable_addStickyEvents

@BillCarsonFr
Copy link
Copy Markdown
Member Author

Closing as we choose to re-use the existing SendEvent action and send the sticky events one by one

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