From d3497cac6889e7fb90e41717f4deda2905e4ecd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Fri, 12 Sep 2025 15:20:18 +0200 Subject: [PATCH 1/2] fix: Set unread notification count only if not null in sync Fixes an edge case in the sdk which sets the unread notification count wrongly to 0 on room fake sync. --- lib/src/client.dart | 11 +++++++---- test/room_test.dart | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 8384edfb..22a7b922 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -2979,10 +2979,13 @@ class Client extends MatrixApi { rooms[roomIndex].prev_batch = chatUpdate.timeline?.prevBatch; } rooms[roomIndex].membership = membership; - rooms[roomIndex].notificationCount = - chatUpdate.unreadNotifications?.notificationCount ?? 0; - rooms[roomIndex].highlightCount = - chatUpdate.unreadNotifications?.highlightCount ?? 0; + + if (chatUpdate.unreadNotifications != null) { + rooms[roomIndex].notificationCount = + chatUpdate.unreadNotifications?.notificationCount ?? 0; + rooms[roomIndex].highlightCount = + chatUpdate.unreadNotifications?.highlightCount ?? 0; + } final summary = chatUpdate.summary; if (summary != null) { diff --git a/test/room_test.dart b/test/room_test.dart index 2bf1b684..e6963a4c 100644 --- a/test/room_test.dart +++ b/test/room_test.dart @@ -295,6 +295,8 @@ void main() { ), ); expect(room.hasNewMessages, true); + expect(room.isUnreadOrInvited, true); + room.notificationCount = room.highlightCount = 0; expect(room.isUnreadOrInvited, false); expect(room.lastEvent?.body, 'cd'); await updateLastEvent( From 1237eaddd5569b7161d447cbff93872937fceb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Fri, 12 Sep 2025 15:37:40 +0200 Subject: [PATCH 2/2] build: Use v4 of rust-prepare job --- .github/workflows/app.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 3c0ab0f1..1d82714a 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -18,11 +18,7 @@ jobs: - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 with: sdk: ${{ env.dart_version }} - - uses: famedly/backend-build-workflows/.github/actions/rust-prepare@main - with: - gitlab_user: ${{ secrets.GITLAB_USER }} - gitlab_pass: ${{ secrets.GITLAB_PASS }} - gitlab_ssh: ${{ secrets.CI_SSH_PRIVATE_KEY}} + - uses: famedly/backend-build-workflows/.github/actions/rust-prepare@v4 - name: Run tests run: | export HOMESERVER_IMPLEMENTATION=${{matrix.homeserver}} @@ -68,11 +64,7 @@ jobs: with: sdk: ${{ env.dart_version }} #architecture: "arm64" - - uses: famedly/backend-build-workflows/.github/actions/rust-prepare@main - with: - gitlab_user: ${{ secrets.GITLAB_USER }} - gitlab_pass: ${{ secrets.GITLAB_PASS }} - gitlab_ssh: ${{ secrets.CI_SSH_PRIVATE_KEY}} + - uses: famedly/backend-build-workflows/.github/actions/rust-prepare@v4 - name: Run tests run: | sudo apt-get update && sudo apt-get install --no-install-recommends --no-install-suggests -y lcov libsqlite3-0 libsqlite3-dev libssl3