diff --git a/src/models/room.js b/src/models/room.js index 9c321e1bb..1f19cf198 100644 --- a/src/models/room.js +++ b/src/models/room.js @@ -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