mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-30 08:11:20 +00:00
Adding creator_blocked to PersonMentionView
This commit is contained in:
parent
46d450f565
commit
99158b88d7
1 changed files with 24 additions and 1 deletions
|
@ -19,6 +19,7 @@ use lemmy_db_schema::{
|
||||||
community_person_ban,
|
community_person_ban,
|
||||||
person,
|
person,
|
||||||
person_alias_1,
|
person_alias_1,
|
||||||
|
person_block,
|
||||||
person_mention,
|
person_mention,
|
||||||
post,
|
post,
|
||||||
},
|
},
|
||||||
|
@ -26,6 +27,7 @@ use lemmy_db_schema::{
|
||||||
comment::{Comment, CommentSaved},
|
comment::{Comment, CommentSaved},
|
||||||
community::{Community, CommunityFollower, CommunityPersonBan, CommunitySafe},
|
community::{Community, CommunityFollower, CommunityPersonBan, CommunitySafe},
|
||||||
person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
|
person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
|
||||||
|
person_block::PersonBlock,
|
||||||
person_mention::PersonMention,
|
person_mention::PersonMention,
|
||||||
post::Post,
|
post::Post,
|
||||||
},
|
},
|
||||||
|
@ -46,6 +48,7 @@ pub struct PersonMentionView {
|
||||||
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
||||||
pub subscribed: bool, // Left join to CommunityFollower
|
pub subscribed: bool, // Left join to CommunityFollower
|
||||||
pub saved: bool, // Left join to CommentSaved
|
pub saved: bool, // Left join to CommentSaved
|
||||||
|
pub creator_blocked: bool, // Left join to PersonBlock
|
||||||
pub my_vote: Option<i16>, // Left join to CommentLike
|
pub my_vote: Option<i16>, // Left join to CommentLike
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +63,7 @@ type PersonMentionViewTuple = (
|
||||||
Option<CommunityPersonBan>,
|
Option<CommunityPersonBan>,
|
||||||
Option<CommunityFollower>,
|
Option<CommunityFollower>,
|
||||||
Option<CommentSaved>,
|
Option<CommentSaved>,
|
||||||
|
Option<PersonBlock>,
|
||||||
Option<i16>,
|
Option<i16>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -83,6 +87,7 @@ impl PersonMentionView {
|
||||||
creator_banned_from_community,
|
creator_banned_from_community,
|
||||||
subscribed,
|
subscribed,
|
||||||
saved,
|
saved,
|
||||||
|
creator_blocked,
|
||||||
my_vote,
|
my_vote,
|
||||||
) = person_mention::table
|
) = person_mention::table
|
||||||
.find(person_mention_id)
|
.find(person_mention_id)
|
||||||
|
@ -113,6 +118,13 @@ impl PersonMentionView {
|
||||||
.and(comment_saved::person_id.eq(person_id_join)),
|
.and(comment_saved::person_id.eq(person_id_join)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.left_join(
|
||||||
|
person_block::table.on(
|
||||||
|
comment::creator_id
|
||||||
|
.eq(person_block::recipient_id)
|
||||||
|
.and(person_block::person_id.eq(person_id_join)),
|
||||||
|
),
|
||||||
|
)
|
||||||
.left_join(
|
.left_join(
|
||||||
comment_like::table.on(
|
comment_like::table.on(
|
||||||
comment::id
|
comment::id
|
||||||
|
@ -131,6 +143,7 @@ impl PersonMentionView {
|
||||||
community_person_ban::all_columns.nullable(),
|
community_person_ban::all_columns.nullable(),
|
||||||
community_follower::all_columns.nullable(),
|
community_follower::all_columns.nullable(),
|
||||||
comment_saved::all_columns.nullable(),
|
comment_saved::all_columns.nullable(),
|
||||||
|
person_block::all_columns.nullable(),
|
||||||
comment_like::score.nullable(),
|
comment_like::score.nullable(),
|
||||||
))
|
))
|
||||||
.first::<PersonMentionViewTuple>(conn)?;
|
.first::<PersonMentionViewTuple>(conn)?;
|
||||||
|
@ -146,6 +159,7 @@ impl PersonMentionView {
|
||||||
creator_banned_from_community: creator_banned_from_community.is_some(),
|
creator_banned_from_community: creator_banned_from_community.is_some(),
|
||||||
subscribed: subscribed.is_some(),
|
subscribed: subscribed.is_some(),
|
||||||
saved: saved.is_some(),
|
saved: saved.is_some(),
|
||||||
|
creator_blocked: creator_blocked.is_some(),
|
||||||
my_vote,
|
my_vote,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -238,6 +252,13 @@ impl<'a> PersonMentionQueryBuilder<'a> {
|
||||||
.and(comment_saved::person_id.eq(person_id_join)),
|
.and(comment_saved::person_id.eq(person_id_join)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.left_join(
|
||||||
|
person_block::table.on(
|
||||||
|
comment::creator_id
|
||||||
|
.eq(person_block::recipient_id)
|
||||||
|
.and(person_block::person_id.eq(person_id_join)),
|
||||||
|
),
|
||||||
|
)
|
||||||
.left_join(
|
.left_join(
|
||||||
comment_like::table.on(
|
comment_like::table.on(
|
||||||
comment::id
|
comment::id
|
||||||
|
@ -256,6 +277,7 @@ impl<'a> PersonMentionQueryBuilder<'a> {
|
||||||
community_person_ban::all_columns.nullable(),
|
community_person_ban::all_columns.nullable(),
|
||||||
community_follower::all_columns.nullable(),
|
community_follower::all_columns.nullable(),
|
||||||
comment_saved::all_columns.nullable(),
|
comment_saved::all_columns.nullable(),
|
||||||
|
person_block::all_columns.nullable(),
|
||||||
comment_like::score.nullable(),
|
comment_like::score.nullable(),
|
||||||
))
|
))
|
||||||
.into_boxed();
|
.into_boxed();
|
||||||
|
@ -317,7 +339,8 @@ impl ViewToVec for PersonMentionView {
|
||||||
creator_banned_from_community: a.7.is_some(),
|
creator_banned_from_community: a.7.is_some(),
|
||||||
subscribed: a.8.is_some(),
|
subscribed: a.8.is_some(),
|
||||||
saved: a.9.is_some(),
|
saved: a.9.is_some(),
|
||||||
my_vote: a.10,
|
creator_blocked: a.10.is_some(),
|
||||||
|
my_vote: a.11,
|
||||||
})
|
})
|
||||||
.collect::<Vec<Self>>()
|
.collect::<Vec<Self>>()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue