Fix alias query.

pull/92/head
Kegan Dougal 2015-02-25 17:37:14 +00:00
parent 2b8ca84296
commit 2c79c4dc7f
1 changed files with 5 additions and 6 deletions

View File

@ -141,20 +141,19 @@ class DirectoryStore(SQLBaseStore):
Returns: Returns:
A list of RoomAliasMappings. A list of RoomAliasMappings.
""" """
results = self._simple_select_list( results = yield self._execute_and_decode(
"room_aliases", "SELECT room_id, room_alias FROM room_aliases"
None,
["room_alias", "room_id"]
) )
# TODO(kegan): It feels wrong to be specifying no servers here, but # TODO(kegan): It feels wrong to be specifying no servers here, but
# equally this function isn't required to obtain all servers so # equally this function isn't required to obtain all servers so
# retrieving them "just for the sake of it" also seems wrong, but we # retrieving them "just for the sake of it" also seems wrong, but we
# want to conform to passing Objects around and not dicts.. # want to conform to passing Objects around and not dicts..
return [ defer.returnValue([
RoomAliasMapping( RoomAliasMapping(
room_id=r["room_id"], room_alias=r["room_alias"], servers="" room_id=r["room_id"], room_alias=r["room_alias"], servers=""
) for r in results ) for r in results
] ])
def get_aliases_for_room(self, room_id): def get_aliases_for_room(self, room_id):