Support m.jitsi-typed widgets as Jitsi widgets

Fixes https://github.com/vector-im/riot-web/issues/9268
This commit is contained in:
Travis Ralston 2020-04-09 15:11:57 -06:00
parent 4d461c6d87
commit dc92f557fd
5 changed files with 54 additions and 16 deletions

View file

@ -16,6 +16,7 @@ limitations under the License.
*/
import EventEmitter from 'events';
import {WidgetType} from "../widgets/WidgetType";
/**
* Acts as a place to get & set widget state, storing local echo state and
@ -64,7 +65,7 @@ class WidgetEchoStore extends EventEmitter {
return echoedWidgets;
}
roomHasPendingWidgetsOfType(roomId, currentRoomWidgets, type) {
roomHasPendingWidgetsOfType(roomId, currentRoomWidgets, type: WidgetType) {
const roomEchoState = Object.assign({}, this._roomWidgetEcho[roomId]);
// any widget IDs that are already in the room are not pending, so
@ -79,7 +80,7 @@ class WidgetEchoStore extends EventEmitter {
return Object.keys(roomEchoState).length > 0;
} else {
return Object.values(roomEchoState).some((widget) => {
return widget.type === type;
return type.matches(widget.type);
});
}
}