mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-14 00:14:03 +00:00
Some formatting
This commit is contained in:
parent
51e181c529
commit
ef7fe7586b
7 changed files with 26 additions and 9 deletions
|
@ -1,6 +1,11 @@
|
||||||
use crate::PerformCrud;
|
use crate::PerformCrud;
|
||||||
use actix_web::web::Data;
|
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_queries::{from_opt_str_to_opt_enum, ListingType, SortType};
|
||||||
use lemmy_db_views::comment_view::CommentQueryBuilder;
|
use lemmy_db_views::comment_view::CommentQueryBuilder;
|
||||||
use lemmy_utils::{ApiError, ConnectionId, LemmyError};
|
use lemmy_utils::{ApiError, ConnectionId, LemmyError};
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
use crate::PerformCrud;
|
use crate::PerformCrud;
|
||||||
use actix_web::web::Data;
|
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_queries::{from_opt_str_to_opt_enum, ListingType, SortType};
|
||||||
use lemmy_db_views::{
|
use lemmy_db_views::{
|
||||||
comment_view::CommentQueryBuilder,
|
comment_view::CommentQueryBuilder,
|
||||||
|
|
|
@ -67,7 +67,7 @@ impl PerformCrud for CreateSite {
|
||||||
open_registration: data.open_registration,
|
open_registration: data.open_registration,
|
||||||
enable_nsfw: data.enable_nsfw,
|
enable_nsfw: data.enable_nsfw,
|
||||||
updated: None,
|
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);
|
let create_site = move |conn: &'_ _| Site::create(conn, &site_form);
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl PerformCrud for GetSite {
|
||||||
open_registration: None,
|
open_registration: None,
|
||||||
enable_nsfw: None,
|
enable_nsfw: None,
|
||||||
auth: login_response.jwt,
|
auth: login_response.jwt,
|
||||||
community_creation_admin_only: false,
|
community_creation_admin_only: None,
|
||||||
};
|
};
|
||||||
create_site.perform(context, websocket_id).await?;
|
create_site.perform(context, websocket_id).await?;
|
||||||
info!("Site {} created", setup.site_name);
|
info!("Site {} created", setup.site_name);
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
use crate::PerformCrud;
|
use crate::PerformCrud;
|
||||||
use actix_web::web::Data;
|
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_queries::{from_opt_str_to_opt_enum, source::person::Person_, SortType};
|
||||||
use lemmy_db_schema::source::person::*;
|
use lemmy_db_schema::source::person::*;
|
||||||
use lemmy_db_views::{comment_view::CommentQueryBuilder, post_view::PostQueryBuilder};
|
use lemmy_db_views::{comment_view::CommentQueryBuilder, post_view::PostQueryBuilder};
|
||||||
|
|
|
@ -264,8 +264,8 @@ impl<'a> CommentQueryBuilder<'a> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_bot_accounts(mut self, show_bot_accounts: bool) -> 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
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ impl<'a> PostQueryBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_bot_accounts<T: MaybeOptional<bool>>(mut self, show_bot_accounts: T) -> 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
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ impl<'a> PostQueryBuilder<'a> {
|
||||||
.filter(community::nsfw.eq(false));
|
.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));
|
query = query.filter(person::bot_account.eq(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue