1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

Merge pull request #1635 from matrix-org/travis/media-customization

Add a function to get a room's MXC URI
This commit is contained in:
Travis Ralston
2021-03-08 18:23:00 -07:00
committed by GitHub

View File

@@ -818,7 +818,7 @@ Room.prototype.getBlacklistUnverifiedDevices = function() {
*/
Room.prototype.getAvatarUrl = function(baseUrl, width, height, resizeMethod,
allowDefault) {
const roomAvatarEvent = this.currentState.getStateEvents("m.room.avatar", "");
const roomAvatarEvent = this.currentState.getStateEvents(EventType.RoomAvatar, "");
if (allowDefault === undefined) {
allowDefault = true;
}
@@ -836,6 +836,15 @@ Room.prototype.getAvatarUrl = function(baseUrl, width, height, resizeMethod,
return null;
};
/**
* Get the mxc avatar url for the room, if one was set.
* @return {string} the mxc avatar url or falsy
*/
Room.prototype.getMxcAvatarUrl = function() {
const roomAvatarEvent = this.currentState.getStateEvents(EventType.RoomAvatar, "");
return roomAvatarEvent ? roomAvatarEvent.getContent().url : null;
};
/**
* Get the aliases this room has according to the room's state
* The aliases returned by this function may not necessarily