mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-29 15:51:20 +00:00
cargo fmt
This commit is contained in:
parent
318f7779a1
commit
5e1bd1ce58
8 changed files with 42 additions and 25 deletions
|
@ -74,7 +74,9 @@ fn queries<'a>() -> Queries<
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
comment_like::score.nullable(),
|
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 {
|
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::JoinTuple,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
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,
|
my_vote,
|
||||||
creator_banned_from_community,
|
creator_banned_from_community,
|
||||||
counts: counts.into_full(&comment),
|
counts: counts.into_full(&comment),
|
||||||
|
|
|
@ -31,7 +31,7 @@ use lemmy_db_schema::{
|
||||||
},
|
},
|
||||||
source::{
|
source::{
|
||||||
comment::Comment,
|
comment::Comment,
|
||||||
community::{CommunityWithoutId, CommunityFollower},
|
community::{CommunityFollower, CommunityWithoutId},
|
||||||
person::PersonWithoutId,
|
person::PersonWithoutId,
|
||||||
post::PostWithoutId,
|
post::PostWithoutId,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
use crate::structs::LocalUserView;
|
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 diesel_async::RunQueryDsl;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
aggregates::structs::PersonAggregates,
|
aggregates::structs::PersonAggregates,
|
||||||
|
|
|
@ -24,7 +24,12 @@ use lemmy_db_schema::{
|
||||||
post_like,
|
post_like,
|
||||||
post_report,
|
post_report,
|
||||||
},
|
},
|
||||||
source::{community::CommunityWithoutId, person::PersonWithoutId, post::PostWithoutId, post_report::PostReport},
|
source::{
|
||||||
|
community::CommunityWithoutId,
|
||||||
|
person::PersonWithoutId,
|
||||||
|
post::PostWithoutId,
|
||||||
|
post_report::PostReport,
|
||||||
|
},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
};
|
};
|
||||||
|
@ -216,7 +221,9 @@ impl JoinView for PostReportView {
|
||||||
): Self::JoinTuple,
|
): Self::JoinTuple,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
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),
|
counts: counts.into_full(&post),
|
||||||
my_vote,
|
my_vote,
|
||||||
creator_banned_from_community,
|
creator_banned_from_community,
|
||||||
|
|
|
@ -35,7 +35,7 @@ use lemmy_db_schema::{
|
||||||
post_saved,
|
post_saved,
|
||||||
},
|
},
|
||||||
source::{
|
source::{
|
||||||
community::{CommunityWithoutId, CommunityFollower},
|
community::{CommunityFollower, CommunityWithoutId},
|
||||||
person::PersonWithoutId,
|
person::PersonWithoutId,
|
||||||
post::Post,
|
post::Post,
|
||||||
},
|
},
|
||||||
|
|
|
@ -51,7 +51,9 @@ fn queries<'a>() -> Queries<
|
||||||
PrivateMessageWithoutId::as_select(),
|
PrivateMessageWithoutId::as_select(),
|
||||||
PersonWithoutId::as_select(),
|
PersonWithoutId::as_select(),
|
||||||
aliases::person1.fields(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::JoinTuple,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
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),
|
creator: creator.into_full(private_message_report.creator_id),
|
||||||
private_message_creator: private_message_creator.into_full(private_message.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),
|
private_message: private_message.into_full(private_message_report.private_message_id),
|
||||||
|
|
|
@ -130,13 +130,7 @@ impl PrivateMessageQuery {
|
||||||
|
|
||||||
impl JoinView for PrivateMessageView {
|
impl JoinView for PrivateMessageView {
|
||||||
type JoinTuple = PrivateMessageViewTuple;
|
type JoinTuple = PrivateMessageViewTuple;
|
||||||
fn from_tuple(
|
fn from_tuple((private_message, creator, recipient): Self::JoinTuple) -> Self {
|
||||||
(
|
|
||||||
private_message,
|
|
||||||
creator,
|
|
||||||
recipient,
|
|
||||||
): Self::JoinTuple,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
Self {
|
||||||
creator: creator.into_full(private_message.creator_id),
|
creator: creator.into_full(private_message.creator_id),
|
||||||
recipient: recipient.into_full(private_message.recipient_id),
|
recipient: recipient.into_full(private_message.recipient_id),
|
||||||
|
|
|
@ -22,8 +22,12 @@ use lemmy_db_schema::{
|
||||||
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
};
|
};
|
||||||
|
|
||||||
type RegistrationApplicationViewTuple =
|
type RegistrationApplicationViewTuple = (
|
||||||
(RegistrationApplication, LocalUserWithoutId, PersonWithoutId, Option<PersonWithoutId>);
|
RegistrationApplication,
|
||||||
|
LocalUserWithoutId,
|
||||||
|
PersonWithoutId,
|
||||||
|
Option<PersonWithoutId>,
|
||||||
|
);
|
||||||
|
|
||||||
fn queries<'a>() -> Queries<
|
fn queries<'a>() -> Queries<
|
||||||
impl ReadFn<'a, RegistrationApplicationView, i32>,
|
impl ReadFn<'a, RegistrationApplicationView, i32>,
|
||||||
|
@ -42,7 +46,9 @@ fn queries<'a>() -> Queries<
|
||||||
registration_application::all_columns,
|
registration_application::all_columns,
|
||||||
LocalUserWithoutId::as_select(),
|
LocalUserWithoutId::as_select(),
|
||||||
PersonWithoutId::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 {
|
impl JoinView for RegistrationApplicationView {
|
||||||
type JoinTuple = RegistrationApplicationViewTuple;
|
type JoinTuple = RegistrationApplicationViewTuple;
|
||||||
fn from_tuple(
|
fn from_tuple(
|
||||||
(
|
(registration_application, creator_local_user, creator, admin): Self::JoinTuple,
|
||||||
registration_application,
|
|
||||||
creator_local_user,
|
|
||||||
creator,
|
|
||||||
admin,
|
|
||||||
): Self::JoinTuple,
|
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
admin: admin.into_full(registration_application.admin_id),
|
admin: admin.into_full(registration_application.admin_id),
|
||||||
|
|
Loading…
Reference in a new issue