From eed51913c43aaac6ecc84a10ff06cb861c28a244 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 18 Jul 2019 18:47:59 +0200 Subject: [PATCH 1/4] [Notifications] Fix missing DB and missing slash --- lib/src/Client.dart | 2 +- lib/src/Store.dart | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/Client.dart b/lib/src/Client.dart index bdc4b25..748d312 100644 --- a/lib/src/Client.dart +++ b/lib/src/Client.dart @@ -243,7 +243,7 @@ class Client { Future getPushrules() async { final dynamic resp = await connection.jsonRequest( type: HTTPType.GET, - action: "/client/r0/pushrules", + action: "/client/r0/pushrules/", ); if (resp is ErrorResponse) { diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 47731d0..7c286ca 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -100,6 +100,7 @@ class Store { await db.execute(RoomsScheme); await db.execute(UserScheme); await db.execute(EventsScheme); + await db.execute(NotificationsCacheScheme); } Future queryPrevBatch() async { @@ -716,7 +717,7 @@ class Store { 'UNIQUE(chat_id, matrix_id))'; /// The database scheme for the NotificationsCache class. - static final String NotificationsCache = 'CREATE TABLE IF NOT EXISTS NotificationsCache(' + + static final String NotificationsCacheScheme = 'CREATE TABLE IF NOT EXISTS NotificationsCache(' + 'chat_id TEXT, ' + // The chat id 'event_id TEXT, ' + // The matrix id of the Event 'UNIQUE(event_id))'; From b3e8a81dfc0a3ddd9ebae23832b59274fe01b695 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 18 Jul 2019 18:49:04 +0200 Subject: [PATCH 2/4] [Store] Increase DB version --- lib/src/Store.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 7c286ca..30ff0a1 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -55,7 +55,7 @@ class Store { _init() async { var databasePath = await getDatabasesPath(); String path = p.join(databasePath, "FluffyMatrix.db"); - _db = await openDatabase(path, version: 5, + _db = await openDatabase(path, version: 6, onCreate: (Database db, int version) async { await createTables(db); }, onUpgrade: (Database db, int oldVersion, int newVersion) async { From 330863b06601637b08d29155fd6503a288a8b6a0 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 18 Jul 2019 18:54:58 +0200 Subject: [PATCH 3/4] [FakeMatrixAPI] add missing slash --- test/FakeMatrixApi.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/FakeMatrixApi.dart b/test/FakeMatrixApi.dart index 7e06131..89a7b51 100644 --- a/test/FakeMatrixApi.dart +++ b/test/FakeMatrixApi.dart @@ -164,7 +164,7 @@ class FakeMatrixApi extends MockClient { } ] }, - "/client/r0/pushrules": (var req) => { + "/client/r0/pushrules/": (var req) => { "global": { "content": [ { From 650810c63efae6bc7d826a1ddf01054adf1148e3 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 18 Jul 2019 19:01:05 +0200 Subject: [PATCH 4/4] [FakeMatrixAPI] add missing slash --- test/Client_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Client_test.dart b/test/Client_test.dart index 64a5104..8a2e965 100644 --- a/test/Client_test.dart +++ b/test/Client_test.dart @@ -244,7 +244,7 @@ void main() { test('getPushrules', () async { final PushrulesResponse pushrules = await matrix.getPushrules(); final PushrulesResponse awaited_resp = PushrulesResponse.fromJson( - FakeMatrixApi.api["GET"]["/client/r0/pushrules"]("")); + FakeMatrixApi.api["GET"]["/client/r0/pushrules/"]("")); expect(pushrules.toJson(), awaited_resp.toJson()); });