]> Untitled Git - lemmy.git/commitdiff
Some formatting
authorDessalines <tyhou13@gmx.com>
Fri, 23 Apr 2021 06:40:10 +0000 (02:40 -0400)
committerDessalines <tyhou13@gmx.com>
Fri, 23 Apr 2021 06:40:10 +0000 (02:40 -0400)
crates/api_crud/src/comment/read.rs
crates/api_crud/src/post/read.rs
crates/api_crud/src/site/create.rs
crates/api_crud/src/site/read.rs
crates/api_crud/src/user/read.rs
crates/db_views/src/comment_view.rs
crates/db_views/src/post_view.rs

index ceed00959c1fd7de740b0dcf6c38135aa72fd1d0..f82b97481844eab8c314ebb2dd339662b87fa906 100644 (file)
@@ -1,6 +1,11 @@
 use crate::PerformCrud;
 use actix_web::web::Data;
-use lemmy_api_common::{blocking, comment::*, get_local_user_view_from_jwt_opt, user_show_bot_accounts};
+use lemmy_api_common::{
+  blocking,
+  comment::*,
+  get_local_user_view_from_jwt_opt,
+  user_show_bot_accounts,
+};
 use lemmy_db_queries::{from_opt_str_to_opt_enum, ListingType, SortType};
 use lemmy_db_views::comment_view::CommentQueryBuilder;
 use lemmy_utils::{ApiError, ConnectionId, LemmyError};
index 858a878f54f0d376231609c9f205f28e532ab2e6..14c6cad5f453d1ccd1e9d6433d50c78d0fc6315a 100644 (file)
@@ -1,6 +1,12 @@
 use crate::PerformCrud;
 use actix_web::web::Data;
-use lemmy_api_common::{blocking, get_local_user_view_from_jwt_opt, post::*, user_show_bot_accounts, user_show_nsfw};
+use lemmy_api_common::{
+  blocking,
+  get_local_user_view_from_jwt_opt,
+  post::*,
+  user_show_bot_accounts,
+  user_show_nsfw,
+};
 use lemmy_db_queries::{from_opt_str_to_opt_enum, ListingType, SortType};
 use lemmy_db_views::{
   comment_view::CommentQueryBuilder,
index dc6e649d6a096a5816e08c19c8af93ed024d24dc..2b876c2ff6cd7a8b8ea4d7c3f17662b40e60b16d 100644 (file)
@@ -67,7 +67,7 @@ impl PerformCrud for CreateSite {
       open_registration: data.open_registration,
       enable_nsfw: data.enable_nsfw,
       updated: None,
-      community_creation_admin_only: Some(data.community_creation_admin_only),
+      community_creation_admin_only: data.community_creation_admin_only,
     };
 
     let create_site = move |conn: &'_ _| Site::create(conn, &site_form);
index fb409f1cac1e71938ab91a1d33b34d5e9abd1cda..9b73c12f83666c88cf4b5b91095106a816300f9c 100644 (file)
@@ -51,7 +51,7 @@ impl PerformCrud for GetSite {
             open_registration: None,
             enable_nsfw: None,
             auth: login_response.jwt,
-            community_creation_admin_only: false,
+            community_creation_admin_only: None,
           };
           create_site.perform(context, websocket_id).await?;
           info!("Site {} created", setup.site_name);
index f32764160f4c3a5b147ed6d50a124127c342af66..81194d1e653ad5f25cb1f80fbdae63ae48d9a742 100644 (file)
@@ -1,6 +1,12 @@
 use crate::PerformCrud;
 use actix_web::web::Data;
-use lemmy_api_common::{blocking, get_local_user_view_from_jwt_opt, person::*, user_show_nsfw, user_show_bot_accounts};
+use lemmy_api_common::{
+  blocking,
+  get_local_user_view_from_jwt_opt,
+  person::*,
+  user_show_bot_accounts,
+  user_show_nsfw,
+};
 use lemmy_db_queries::{from_opt_str_to_opt_enum, source::person::Person_, SortType};
 use lemmy_db_schema::source::person::*;
 use lemmy_db_views::{comment_view::CommentQueryBuilder, post_view::PostQueryBuilder};
index 8c6d44afdbefbfeaf73a82df007df8ccf4a17460..7424d9d6297fec324284f9ef452df7aa45a1be05 100644 (file)
@@ -264,8 +264,8 @@ impl<'a> CommentQueryBuilder<'a> {
     self
   }
 
-  pub fn show_bot_accounts(mut self, show_bot_accounts: bool) -> Self {
-    self.show_bot_accounts = show_bot_accounts;
+  pub fn show_bot_accounts<T: MaybeOptional<bool>>(mut self, show_bot_accounts: T) -> Self {
+    self.show_bot_accounts = show_bot_accounts.get_optional();
     self
   }
 
index 192517e068bac68905d659d0e6e7ddb02e47ad67..4239357546f6f76b2ceea357797c20406df89b66 100644 (file)
@@ -238,7 +238,7 @@ impl<'a> PostQueryBuilder<'a> {
   }
 
   pub fn show_bot_accounts<T: MaybeOptional<bool>>(mut self, show_bot_accounts: T) -> Self {
-    self.show_bot_accounts = show_bot_accounts;
+    self.show_bot_accounts = show_bot_accounts.get_optional();
     self
   }
 
@@ -360,7 +360,7 @@ impl<'a> PostQueryBuilder<'a> {
         .filter(community::nsfw.eq(false));
     };
 
-    if !self.show_bot_accounts {
+    if !self.show_bot_accounts.unwrap_or(true) {
       query = query.filter(person::bot_account.eq(false));
     };