fmt
This commit is contained in:
parent
acb6472cf4
commit
f9185a1ead
6 changed files with 15 additions and 12 deletions
|
|
@ -7,7 +7,8 @@ use lemmy_api_common::{
|
|||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
moderator::{ModAdd, ModAddForm}, local_user::{LocalUserUpdateForm, LocalUser},
|
||||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
moderator::{ModAdd, ModAddForm},
|
||||
},
|
||||
traits::Crud,
|
||||
};
|
||||
|
|
@ -31,7 +32,9 @@ impl Perform for AddAdmin {
|
|||
LocalUser::update(
|
||||
context.pool(),
|
||||
target.local_user.id,
|
||||
&LocalUserUpdateForm::builder().admin(Some(data.added)).build(),
|
||||
&LocalUserUpdateForm::builder()
|
||||
.admin(Some(data.added))
|
||||
.build(),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_user"))?;
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ use lemmy_api_common::{
|
|||
utils::local_user_view_from_jwt,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{person_block::{PersonBlock, PersonBlockForm}},
|
||||
traits::{Blockable},
|
||||
source::person_block::{PersonBlock, PersonBlockForm},
|
||||
traits::Blockable,
|
||||
};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_db_views_actor::structs::PersonView;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
actor_language::SiteLanguage,
|
||||
language::Language,
|
||||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
moderator::{ModAdd, ModAddForm},
|
||||
tagline::Tagline, local_user::{LocalUserUpdateForm, LocalUser},
|
||||
tagline::Tagline,
|
||||
},
|
||||
traits::Crud,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ pub struct LocalUserInsertForm {
|
|||
pub accepted_application: Option<bool>,
|
||||
pub totp_2fa_secret: Option<Option<String>>,
|
||||
pub totp_2fa_url: Option<Option<String>>,
|
||||
pub admin: Option<bool>
|
||||
pub admin: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Clone, TypedBuilder)]
|
||||
|
|
@ -105,5 +105,5 @@ pub struct LocalUserUpdateForm {
|
|||
pub accepted_application: Option<bool>,
|
||||
pub totp_2fa_secret: Option<Option<String>>,
|
||||
pub totp_2fa_url: Option<Option<String>>,
|
||||
pub admin: Option<bool>
|
||||
pub admin: Option<bool>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ mod tests {
|
|||
totp_2fa_secret: inserted_sara_local_user.totp_2fa_secret,
|
||||
totp_2fa_url: inserted_sara_local_user.totp_2fa_url,
|
||||
password_encrypted: inserted_sara_local_user.password_encrypted,
|
||||
admin: inserted_sara_local_user.admin
|
||||
admin: inserted_sara_local_user.admin,
|
||||
},
|
||||
creator: Person {
|
||||
id: inserted_sara_person.id,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use diesel_async::RunQueryDsl;
|
|||
use lemmy_db_schema::{
|
||||
aggregates::structs::PersonAggregates,
|
||||
newtypes::PersonId,
|
||||
schema::{person, person_aggregates},
|
||||
schema::{local_user, person, person_aggregates},
|
||||
source::person::Person,
|
||||
traits::JoinView,
|
||||
utils::{fuzzy_search, get_conn, limit_and_offset, DbPool},
|
||||
|
|
@ -19,7 +19,6 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use std::iter::Iterator;
|
||||
use typed_builder::TypedBuilder;
|
||||
use lemmy_db_schema::schema::local_user;
|
||||
|
||||
type PersonViewTuple = (Person, PersonAggregates);
|
||||
|
||||
|
|
@ -38,8 +37,8 @@ impl PersonView {
|
|||
pub async fn admins(pool: &DbPool) -> Result<Vec<Self>, Error> {
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
let admins = person::table
|
||||
.inner_join(person_aggregates::table)
|
||||
.inner_join(local_user::table)
|
||||
.inner_join(person_aggregates::table)
|
||||
.inner_join(local_user::table)
|
||||
.select((person::all_columns, person_aggregates::all_columns))
|
||||
.filter(local_user::admin.eq(true))
|
||||
.filter(person::deleted.eq(false))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue