diff --git a/crates/api_common/src/post.rs b/crates/api_common/src/post.rs index fa45459e2..018b16aca 100644 --- a/crates/api_common/src/post.rs +++ b/crates/api_common/src/post.rs @@ -85,6 +85,8 @@ pub struct GetPosts { pub show_read: Option, /// If true, then show the nsfw posts (even if your user setting is to hide them) pub show_nsfw: Option, + /// Whether to automatically mark fetched posts as read. + pub auto_mark_fetched_posts_as_read: Option, pub page_cursor: Option, } diff --git a/crates/apub/src/api/list_posts.rs b/crates/apub/src/api/list_posts.rs index 6d569bf67..afec96c00 100644 --- a/crates/apub/src/api/list_posts.rs +++ b/crates/apub/src/api/list_posts.rs @@ -91,9 +91,12 @@ pub async fn list_posts( .await .with_lemmy_type(LemmyErrorType::CouldntGetPosts)?; - // If in their user settings, auto-mark fetched posts as read + // If in their user settings (or as part of the API request), auto-mark fetched posts as read if let Some(local_user) = local_user { - if local_user.auto_mark_fetched_posts_as_read { + if data + .auto_mark_fetched_posts_as_read + .unwrap_or(local_user.auto_mark_fetched_posts_as_read) + { let post_ids = posts.iter().map(|p| p.post.id).collect::>(); PostRead::mark_as_read(&mut context.pool(), &post_ids, local_user.person_id).await?; }