From 4727f07e26972f082db34a79c989b75afa6bb6d0 Mon Sep 17 00:00:00 2001 From: Erwan Leboucher Date: Wed, 22 Jul 2026 23:30:58 +0100 Subject: [PATCH] fix: Correct roomuserid_lastnotificationread table alias roomuserid_lastnotificationread was mapped to userroomid_highlightcount instead of its own table, so last_notification_read() read the highlight count and reset_notification_counts clobbered the highlight table when setting a read marker. Add the missing table definition and fix the alias. --- changelog.d/+a3260bd06.bugfix.md | 1 + src/database/maps.rs | 4 ++++ src/service/rooms/user/mod.rs | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog.d/+a3260bd06.bugfix.md diff --git a/changelog.d/+a3260bd06.bugfix.md b/changelog.d/+a3260bd06.bugfix.md new file mode 100644 index 000000000..8fefe4a60 --- /dev/null +++ b/changelog.d/+a3260bd06.bugfix.md @@ -0,0 +1 @@ +Fixed `roomuserid_lastnotificationread` being aliased to the highlight count table, which clobbered highlight counts when setting a read marker. Contributed by @eleboucher diff --git a/src/database/maps.rs b/src/database/maps.rs index 40336ee17..19e786ebf 100644 --- a/src/database/maps.rs +++ b/src/database/maps.rs @@ -478,6 +478,10 @@ pub(super) static MAPS: &[Descriptor] = &[ name: "logintoken_expiresatuserid", ..descriptor::RANDOM_SMALL }, + Descriptor { + name: "roomuserid_lastnotificationread", + ..descriptor::RANDOM + }, Descriptor { name: "userroomid_highlightcount", ..descriptor::RANDOM diff --git a/src/service/rooms/user/mod.rs b/src/service/rooms/user/mod.rs index 9705e2e3f..a6c9a20e8 100644 --- a/src/service/rooms/user/mod.rs +++ b/src/service/rooms/user/mod.rs @@ -27,7 +27,8 @@ impl crate::Service for Service { db: Data { userroomid_notificationcount: args.db["userroomid_notificationcount"].clone(), userroomid_highlightcount: args.db["userroomid_highlightcount"].clone(), - roomuserid_lastnotificationread: args.db["userroomid_highlightcount"].clone(), + roomuserid_lastnotificationread: args.db["roomuserid_lastnotificationread"] + .clone(), }, services: Services { globals: args.depend::("globals"),