1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Merge pull request #689 from matrix-org/dbkr/show_room_version

Add getVersion to Room
This commit is contained in:
Bruno Windels
2018-08-14 17:54:09 +02:00
committed by GitHub

View File

@@ -174,6 +174,18 @@ function Room(roomId, opts) {
}
utils.inherits(Room, EventEmitter);
/**
* Gets the version of the room
* @returns {string} The version of the room, or null if it could not be determined
*/
Room.prototype.getVersion = function() {
const createEvent = this.currentState.getStateEvents("m.room.create", "");
if (!createEvent) return null;
const ver = createEvent.getContent()['room_version'];
if (ver === undefined) return '1';
return ver;
};
/**
* Get the list of pending sent events for this room
*