diff --git a/lib/post/utils/post.dart b/lib/post/utils/post.dart index 59b66b241..72a68f5b4 100644 --- a/lib/post/utils/post.dart +++ b/lib/post/utils/post.dart @@ -32,11 +32,21 @@ Future markPostAsRead(int postId, bool read) async { if (account?.jwt == null) throw Exception('User not logged in'); - MarkPostAsReadResponse markPostAsReadResponse = await lemmy.run(MarkPostAsRead( - auth: account!.jwt!, - postId: postId, - read: read, - )); + MarkPostAsReadResponse markPostAsReadResponse; + + if (LemmyClient.instance.supportsFeature(LemmyFeature.multiRead)) { + markPostAsReadResponse = await lemmy.run(MarkPostAsRead( + auth: account!.jwt!, + postIds: [postId], + read: read, + )); + } else { + markPostAsReadResponse = await lemmy.run(MarkPostAsRead( + auth: account!.jwt!, + postId: postId, + read: read, + )); + } return markPostAsReadResponse.isSuccess(); }