From 78adb13eda84fe3bb9808d8ce55ef72900425d25 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Thu, 9 Nov 2023 11:25:23 +0000 Subject: [PATCH] narrow: Add ApiNarrowIsUnread --- lib/api/model/narrow.dart | 8 ++++++++ lib/model/internal_link.dart | 2 ++ 2 files changed, 10 insertions(+) diff --git a/lib/api/model/narrow.dart b/lib/api/model/narrow.dart index 8907c4de767..7383d382ba4 100644 --- a/lib/api/model/narrow.dart +++ b/lib/api/model/narrow.dart @@ -114,6 +114,14 @@ class ApiNarrowPmWith extends ApiNarrowDm { ApiNarrowPmWith._(super.operand, {super.negated}); } +// TODO: generalize into ApiNarrowIs +class ApiNarrowIsUnread extends ApiNarrowElement { + @override String get operator => 'is'; + @override String get operand => 'unread'; + + ApiNarrowIsUnread({super.negated}); +} + class ApiNarrowMessageId extends ApiNarrowElement { @override String get operator => 'id'; diff --git a/lib/model/internal_link.dart b/lib/model/internal_link.dart index 7874f989ccb..15fc0cbeb73 100644 --- a/lib/model/internal_link.dart +++ b/lib/model/internal_link.dart @@ -84,6 +84,8 @@ Uri narrowLink(PerAccountStore store, Narrow narrow, {int? nearMessageId}) { fragment.write('${element.operand.join(',')}-$suffix'); case ApiNarrowDm(): assert(false, 'ApiNarrowDm should have been resolved'); + case ApiNarrowIsUnread(): + fragment.write(element.operand.toString()); case ApiNarrowMessageId(): fragment.write(element.operand.toString()); }