Return the room_alias when GETing public rooms.

This commit is contained in:
Kegan Dougal 2014-08-13 11:57:49 +01:00
parent c87e1f6418
commit 9b3702c924

View File

@ -93,7 +93,10 @@ class RoomStore(SQLBaseStore):
latest_topic = ("SELECT max(room_data.id) FROM room_data WHERE " latest_topic = ("SELECT max(room_data.id) FROM room_data WHERE "
+ "room_data.type = ? GROUP BY room_id") + "room_data.type = ? GROUP BY room_id")
query = ("SELECT rooms.*, room_data.content FROM rooms LEFT JOIN " query = ("SELECT rooms.*, room_data.content, room_alias FROM rooms "
+ "LEFT JOIN "
+ "room_aliases ON room_aliases.room_id = rooms.room_id "
+ "LEFT JOIN "
+ "room_data ON rooms.room_id = room_data.room_id WHERE " + "room_data ON rooms.room_id = room_data.room_id WHERE "
+ "(room_data.id IN (" + latest_topic + ") " + "(room_data.id IN (" + latest_topic + ") "
+ "OR room_data.id IS NULL) AND rooms.is_public = ?") + "OR room_data.id IS NULL) AND rooms.is_public = ?")
@ -103,7 +106,7 @@ class RoomStore(SQLBaseStore):
) )
# return only the keys the specification expects # return only the keys the specification expects
ret_keys = ["room_id", "topic"] ret_keys = ["room_id", "topic", "room_alias"]
# extract topic from the json (icky) FIXME # extract topic from the json (icky) FIXME
for i, room_row in enumerate(res): for i, room_row in enumerate(res):