Skip to content

Commit

Permalink
Fix mark post as read when previewing media on 0.19.4 (thunder-app#1444)
Browse files Browse the repository at this point in the history
fixed issue with marking post as read on v0.19.4
  • Loading branch information
hjiangsu authored Jun 13, 2024
1 parent ad83dbc commit c40f69d
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/post/utils/post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,21 @@ Future<bool> 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();
}
Expand Down

0 comments on commit c40f69d

Please sign in to comment.