Merge pull request #5583 from matrix-org/travis/widgets/jitsi-crash

Fix Jitsi widgets causing localized tile crashes
This commit is contained in:
Travis Ralston 2021-01-27 14:59:27 -07:00 committed by GitHub
commit 3229b1fb4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -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) {

View File

@ -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);
};