[Store] Better directchat query

This commit is contained in:
Christian Pauly 2019-07-26 14:55:17 +02:00
parent d334968219
commit fa88a5b2d4

View file

@ -601,7 +601,8 @@ class Store {
/// the user [userID]. Returns null if there is none. /// the user [userID]. Returns null if there is none.
Future<String> getDirectChatRoomID(String userID) async { Future<String> getDirectChatRoomID(String userID) async {
List<Map<String, dynamic>> res = await db.rawQuery( List<Map<String, dynamic>> res = await db.rawQuery(
"SELECT id FROM Rooms WHERE direct_chat_matrix_id=?", [userID]); "SELECT id FROM Rooms WHERE direct_chat_matrix_id=? WHERE membership='join' LIMIT 1",
[userID]);
if (res.length != 1) return null; if (res.length != 1) return null;
return res[0]["id"]; return res[0]["id"];
} }