Skip to content

Commit

Permalink
narrow: Add ApiNarrowIsUnread
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpengi committed Nov 9, 2023
1 parent 6cce020 commit 78adb13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/api/model/narrow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 2 additions & 0 deletions lib/model/internal_link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 78adb13

Please sign in to comment.