Remove get_room_is_public and use get_room instead

pull/8292/head
Andrew Morgan 2020-09-11 16:04:14 +01:00
parent 431e3e3ed9
commit 529863aa81
2 changed files with 7 additions and 21 deletions

View File

@ -28,9 +28,14 @@ class PublicRoomsManager:
room_id: The ID of the room.
Returns:
Whether the room is in the public rooms directory.
Whether the room is in the public rooms directory. Additionally returns False
if the room does not exist.
"""
return await self._store.get_room_is_public(room_id)
room = await self._store.get_room(room_id)
if not room:
return False
return room.get("is_public", False)
async def add_room_to_public_directory(self, room_id: str) -> None:
"""Publishes a room to the public rooms directory.

View File

@ -133,25 +133,6 @@ class RoomWorkerStore(SQLBaseStore):
desc="get_public_room_ids",
)
async def get_room_is_public(self, room_id: str) -> bool:
"""Returns whether a given room is public.
Args:
room_id: The ID of the room.
Returns:
Whether the room is public.
"""
row = await self.db_pool.simple_select_onecol(
table="rooms",
keyvalues={"room_id": room_id},
retcol="is_public",
desc="get_room_is_public",
)
if row:
return bool(row[0])
return False
async def count_public_rooms(
self,
network_tuple: Optional[ThirdPartyInstanceID],