Skip to content

Commit 737cada

Browse files
committed
Add a function to get a room's MXC URI
This matches the RoomMember function of the same name.
1 parent c18ef05 commit 737cada

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/models/room.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,15 @@ Room.prototype.getAvatarUrl = function(baseUrl, width, height, resizeMethod,
836836
return null;
837837
};
838838

839+
/**
840+
* Get the mxc avatar url for the room, if one was set.
841+
* @return {string} the mxc avatar url or falsy
842+
*/
843+
Room.prototype.getMxcAvatarUrl = function() {
844+
const roomAvatarEvent = this.currentState.getStateEvents("m.room.avatar", "");
845+
return roomAvatarEvent ? roomAvatarEvent.getContent().url : null;
846+
}
847+
839848
/**
840849
* Get the aliases this room has according to the room's state
841850
* The aliases returned by this function may not necessarily

0 commit comments

Comments
 (0)