cargo fmt

This commit is contained in:
dull b 2023-08-01 18:43:49 +00:00
parent 318f7779a1
commit 5e1bd1ce58
8 changed files with 42 additions and 25 deletions

View file

@ -74,7 +74,9 @@ fn queries<'a>() -> Queries<
CommentAggregatesNotInComment::as_select(),
community_person_ban::id.nullable().is_not_null(),
comment_like::score.nullable(),
aliases::person2.fields(PersonWithoutId::as_select()).nullable(),
aliases::person2
.fields(PersonWithoutId::as_select())
.nullable(),
);
let read = move |mut conn: DbConn<'a>, (report_id, my_person_id): (CommentReportId, PersonId)| async move {
@ -249,7 +251,9 @@ impl JoinView for CommentReportView {
): Self::JoinTuple,
) -> Self {
Self {
resolver: resolver.zip(comment_report.resolver_id).map(|(resolver, id)| resolver.into_full(id)),
resolver: resolver
.zip(comment_report.resolver_id)
.map(|(resolver, id)| resolver.into_full(id)),
my_vote,
creator_banned_from_community,
counts: counts.into_full(&comment),

View file

@ -31,7 +31,7 @@ use lemmy_db_schema::{
},
source::{
comment::Comment,
community::{CommunityWithoutId, CommunityFollower},
community::{CommunityFollower, CommunityWithoutId},
person::PersonWithoutId,
post::PostWithoutId,
},

View file

@ -1,5 +1,12 @@
use crate::structs::LocalUserView;
use diesel::{result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, QueryDsl, SelectableHelper};
use diesel::{
result::Error,
BoolExpressionMethods,
ExpressionMethods,
JoinOnDsl,
QueryDsl,
SelectableHelper,
};
use diesel_async::RunQueryDsl;
use lemmy_db_schema::{
aggregates::structs::PersonAggregates,

View file

@ -24,7 +24,12 @@ use lemmy_db_schema::{
post_like,
post_report,
},
source::{community::CommunityWithoutId, person::PersonWithoutId, post::PostWithoutId, post_report::PostReport},
source::{
community::CommunityWithoutId,
person::PersonWithoutId,
post::PostWithoutId,
post_report::PostReport,
},
traits::JoinView,
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
};
@ -216,7 +221,9 @@ impl JoinView for PostReportView {
): Self::JoinTuple,
) -> Self {
Self {
resolver: (resolver, post_report.resolver_id).zip().map(|(resolver, id)| resolver.into_full(id)),
resolver: (resolver, post_report.resolver_id)
.zip()
.map(|(resolver, id)| resolver.into_full(id)),
counts: counts.into_full(&post),
my_vote,
creator_banned_from_community,

View file

@ -35,7 +35,7 @@ use lemmy_db_schema::{
post_saved,
},
source::{
community::{CommunityWithoutId, CommunityFollower},
community::{CommunityFollower, CommunityWithoutId},
person::PersonWithoutId,
post::Post,
},

View file

@ -51,7 +51,9 @@ fn queries<'a>() -> Queries<
PrivateMessageWithoutId::as_select(),
PersonWithoutId::as_select(),
aliases::person1.fields(PersonWithoutId::as_select()),
aliases::person2.fields(PersonWithoutId::as_select()).nullable(),
aliases::person2
.fields(PersonWithoutId::as_select())
.nullable(),
))
};
@ -132,7 +134,9 @@ impl JoinView for PrivateMessageReportView {
): Self::JoinTuple,
) -> Self {
Self {
resolver: (resolver, private_message_report.resolver_id).zip().map(|(resolver, id)| resolver.into_full(id)),
resolver: (resolver, private_message_report.resolver_id)
.zip()
.map(|(resolver, id)| resolver.into_full(id)),
creator: creator.into_full(private_message_report.creator_id),
private_message_creator: private_message_creator.into_full(private_message.creator_id),
private_message: private_message.into_full(private_message_report.private_message_id),

View file

@ -130,13 +130,7 @@ impl PrivateMessageQuery {
impl JoinView for PrivateMessageView {
type JoinTuple = PrivateMessageViewTuple;
fn from_tuple(
(
private_message,
creator,
recipient,
): Self::JoinTuple,
) -> Self {
fn from_tuple((private_message, creator, recipient): Self::JoinTuple) -> Self {
Self {
creator: creator.into_full(private_message.creator_id),
recipient: recipient.into_full(private_message.recipient_id),

View file

@ -22,8 +22,12 @@ use lemmy_db_schema::{
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
};
type RegistrationApplicationViewTuple =
(RegistrationApplication, LocalUserWithoutId, PersonWithoutId, Option<PersonWithoutId>);
type RegistrationApplicationViewTuple = (
RegistrationApplication,
LocalUserWithoutId,
PersonWithoutId,
Option<PersonWithoutId>,
);
fn queries<'a>() -> Queries<
impl ReadFn<'a, RegistrationApplicationView, i32>,
@ -42,7 +46,9 @@ fn queries<'a>() -> Queries<
registration_application::all_columns,
LocalUserWithoutId::as_select(),
PersonWithoutId::as_select(),
aliases::person1.fields(PersonWithoutId::as_select()).nullable(),
aliases::person1
.fields(PersonWithoutId::as_select())
.nullable(),
))
};
@ -139,12 +145,7 @@ impl RegistrationApplicationQuery {
impl JoinView for RegistrationApplicationView {
type JoinTuple = RegistrationApplicationViewTuple;
fn from_tuple(
(
registration_application,
creator_local_user,
creator,
admin,
): Self::JoinTuple,
(registration_application, creator_local_user, creator, admin): Self::JoinTuple,
) -> Self {
Self {
admin: admin.into_full(registration_application.admin_id),