fix(notifications): handle limit=0 in getNotifications query

Replace falsy guards with explicit undefined checks so that a
limit or offset of 0 is not silently discarded.

Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
This commit is contained in:
Suhrid Marwah
2026-04-11 04:32:24 +05:30
committed by suhr25
parent 2b4f97adf7
commit f7cddd3f20
2 changed files with 7 additions and 2 deletions
@@ -469,6 +469,11 @@ describe.each(databases.eachSupportedId())(
id3,
]);
});
it('should return empty array when limit is 0', async () => {
const result = await storage.getNotifications({ user, limit: 0 });
expect(result).toEqual([]);
});
});
describe('getNotifications sorting', () => {
@@ -289,11 +289,11 @@ export class DatabaseNotificationsStore implements NotificationsStore {
}
}
if (options.limit) {
if (options.limit !== undefined) {
query.limit(options.limit);
}
if (options.offset) {
if (options.offset !== undefined) {
query.offset(options.offset);
}