-
-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add user setting to auto-mark fetched posts as read. #5160
Changes from 6 commits
bd0e68f
3dbc33e
176b9af
8997119
3034aa1
879b8e9
a1ac93d
355c8f6
cdb324d
9e7ab40
923d7f0
11730a2
8b53a68
bebb167
e0da787
912aafb
0747e60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,9 @@ pub struct GetPosts { | |
/// If true, then show the nsfw posts (even if your user setting is to hide them) | ||
#[cfg_attr(feature = "full", ts(optional))] | ||
pub show_nsfw: Option<bool>, | ||
/// Whether to automatically mark fetched posts as read. | ||
#[cfg_attr(feature = "full", ts(optional))] | ||
pub auto_mark_fetched_posts_as_read: Option<bool>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be changed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. K fixed. |
||
#[cfg_attr(feature = "full", ts(optional))] | ||
/// If true, then only show posts with no comments | ||
pub no_comments_only: Option<bool>, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ use lemmy_db_schema::{ | |
password_reset_request::PasswordResetRequest, | ||
person::{Person, PersonUpdateForm}, | ||
person_block::PersonBlock, | ||
post::{Post, PostLike, PostRead}, | ||
post::{Post, PostLike}, | ||
registration_application::RegistrationApplication, | ||
site::Site, | ||
}, | ||
|
@@ -64,7 +64,7 @@ use lemmy_utils::{ | |
use moka::future::Cache; | ||
use regex::{escape, Regex, RegexSet}; | ||
use rosetta_i18n::{Language, LanguageId}; | ||
use std::{collections::HashSet, sync::LazyLock}; | ||
use std::sync::LazyLock; | ||
use tracing::warn; | ||
use url::{ParseError, Url}; | ||
use urlencoding::encode; | ||
|
@@ -140,19 +140,6 @@ pub fn is_top_mod( | |
} | ||
} | ||
|
||
/// Marks a post as read for a given person. | ||
#[tracing::instrument(skip_all)] | ||
pub async fn mark_post_as_read( | ||
person_id: PersonId, | ||
post_id: PostId, | ||
pool: &mut DbPool<'_>, | ||
) -> LemmyResult<()> { | ||
PostRead::mark_as_read(pool, HashSet::from([post_id]), person_id) | ||
.await | ||
.with_lemmy_type(LemmyErrorType::CouldntMarkPostAsRead)?; | ||
Ok(()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of these changes are boilerplate, because I've gotten rid of this pointless wrapper function, by having |
||
} | ||
|
||
/// Updates the read comment count for a post. Usually done when reading or creating a new comment. | ||
#[tracing::instrument(skip_all)] | ||
pub async fn update_read_comments( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got rid of all these fairly pointless HashSets (a way to enforce uniqueness of post ids to be marked as read).
Since we're no longer allowing vectors of marked read post ids via the API, and only through code, these seemed redundant. Also postgres can handle
in
queries with the same ID with no problem anyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this function is unused now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed that now in other PRs.