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};
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,
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);
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);
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};
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
}
}
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
}
.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));
};