]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/post/list.rs
Tag posts and comments with language (fixes #440) (#2269)
[lemmy.git] / crates / api_crud / src / post / list.rs
index 468910b24c697802af0e5f8c5cc8892387b51022..9d9b156c617979adfdb18ddc5c3aa8b6e16702ab 100644 (file)
@@ -32,15 +32,7 @@ impl PerformCrud for GetPosts {
 
     check_private_instance(&local_user_view, context.pool()).await?;
 
-    let person_id = local_user_view.to_owned().map(|l| l.person.id);
-
-    let show_nsfw = local_user_view.as_ref().map(|t| t.local_user.show_nsfw);
-    let show_bot_accounts = local_user_view
-      .as_ref()
-      .map(|t| t.local_user.show_bot_accounts);
-    let show_read_posts = local_user_view
-      .as_ref()
-      .map(|t| t.local_user.show_read_posts);
+    let is_logged_in = local_user_view.is_some();
 
     let sort = data.sort;
     let listing_type = listing_type_with_site_default(data.type_, context.pool()).await?;
@@ -63,13 +55,9 @@ impl PerformCrud for GetPosts {
         .conn(conn)
         .listing_type(Some(listing_type))
         .sort(sort)
-        .show_nsfw(show_nsfw)
-        .show_bot_accounts(show_bot_accounts)
-        .show_read_posts(show_read_posts)
         .community_id(community_id)
         .community_actor_id(community_actor_id)
         .saved_only(saved_only)
-        .my_person_id(person_id)
         .page(page)
         .limit(limit)
         .build()
@@ -79,7 +67,7 @@ impl PerformCrud for GetPosts {
     .map_err(|e| LemmyError::from_error_message(e, "couldnt_get_posts"))?;
 
     // Blank out deleted or removed info for non-logged in users
-    if person_id.is_none() {
+    if !is_logged_in {
       for pv in posts
         .iter_mut()
         .filter(|p| p.post.deleted || p.post.removed)