Use the now fixed nio.MatrixRoom.display_name

The property behaves according to the Matrix standard starting from nio
0.5, no need to generate the room display name ourself anymore.
This commit is contained in:
miruka 2019-08-29 16:47:07 -04:00
parent 665211a8d3
commit 552a4b53fb

View File

@ -404,12 +404,6 @@ class MatrixClient(nio.AsyncClient):
async def register_nio_room(self, room: nio.MatrixRoom, left: bool = False, async def register_nio_room(self, room: nio.MatrixRoom, left: bool = False,
) -> None: ) -> None:
# Generate the room name
name = room.name or room.canonical_alias
if not name:
name = room.group_name()
name = "" if name == "Empty room?" else name
# Add room # Add room
try: try:
last_ev = self.models[Room, self.user_id][room.room_id].last_event last_ev = self.models[Room, self.user_id][room.room_id].last_event
@ -420,7 +414,7 @@ class MatrixClient(nio.AsyncClient):
self.models[Room, self.user_id][room.room_id] = Room( self.models[Room, self.user_id][room.room_id] = Room(
room_id = room.room_id, room_id = room.room_id,
display_name = name, display_name = room.display_name,
avatar_url = room.gen_avatar_url or "", avatar_url = room.gen_avatar_url or "",
topic = room.topic or "", topic = room.topic or "",
inviter_id = inviter, inviter_id = inviter,