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

Commit

Permalink
Fix Jitsi widgets causing localized tile crashes
Browse files Browse the repository at this point in the history
Seems to be that as part of the layout work the timing sequence for when `.getRoom().widgets` will work changed. We can get around this with `initIfNeeded` which will no-op in the worst case.

This also includes a copy change to make ended conferences stop lying about where to find the widget. This is work towards https://github.com/vector-im/element-web/issues/15739
  • Loading branch information
turt2live committed Jan 27, 2021
1 parent 33a86f6 commit c1b33d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/views/messages/MJitsiWidgetEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ export default class MJitsiWidgetEvent extends React.PureComponent<IProps> {
const senderName = this.props.mxEvent.sender?.name || this.props.mxEvent.getSender();
const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId());
const widgetId = this.props.mxEvent.getStateKey();
const widget = WidgetStore.instance.getRoom(room.roomId).widgets.find(w => w.id === widgetId);
const widget = WidgetStore.instance.getRoom(room.roomId, true).widgets.find(w => w.id === widgetId);

let joinCopy = _t('Join the conference at the top of this room');
if (widget && WidgetLayoutStore.instance.isInContainer(room, widget, Container.Right)) {
joinCopy = _t('Join the conference from the room information card on the right');
} else if (!widget) {
joinCopy = null;
}

if (!url) {
Expand Down
3 changes: 2 additions & 1 deletion src/stores/WidgetStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ export default class WidgetStore extends AsyncStoreWithClient<IState> {
this.emit(UPDATE_EVENT, roomId);
};

public getRoom = (roomId: string) => {
public getRoom = (roomId: string, initIfNeeded = false) => {
if (initIfNeeded) this.initRoom(roomId); // internally handles "if needed"
return this.roomMap.get(roomId);
};

Expand Down

0 comments on commit c1b33d3

Please sign in to comment.