mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-25 14:00:19 +00:00
Adding creator_is_moderator to CommentReplyView and PersonMentionView. (#4126)
This commit is contained in:
parent
1e59e7ab47
commit
eeec56c22d
3 changed files with 32 additions and 5 deletions
|
@ -20,6 +20,7 @@ use lemmy_db_schema::{
|
|||
comment_saved,
|
||||
community,
|
||||
community_follower,
|
||||
community_moderator,
|
||||
community_person_ban,
|
||||
person,
|
||||
person_block,
|
||||
|
@ -80,6 +81,13 @@ fn queries<'a>() -> Queries<
|
|||
.and(comment_like::person_id.eq(person_id_join)),
|
||||
),
|
||||
)
|
||||
.left_join(
|
||||
community_moderator::table.on(
|
||||
community::id
|
||||
.eq(community_moderator::community_id)
|
||||
.and(community_moderator::person_id.eq(comment::creator_id)),
|
||||
),
|
||||
)
|
||||
.select((
|
||||
comment_reply::all_columns,
|
||||
comment::all_columns,
|
||||
|
@ -89,6 +97,7 @@ fn queries<'a>() -> Queries<
|
|||
aliases::person1.fields(person::all_columns),
|
||||
comment_aggregates::all_columns,
|
||||
community_person_ban::id.nullable().is_not_null(),
|
||||
community_moderator::id.nullable().is_not_null(),
|
||||
CommunityFollower::select_subscribed_type(),
|
||||
comment_saved::id.nullable().is_not_null(),
|
||||
person_block::id.nullable().is_not_null(),
|
||||
|
|
|
@ -20,6 +20,7 @@ use lemmy_db_schema::{
|
|||
comment_saved,
|
||||
community,
|
||||
community_follower,
|
||||
community_moderator,
|
||||
community_person_ban,
|
||||
person,
|
||||
person_block,
|
||||
|
@ -85,6 +86,7 @@ fn queries<'a>() -> Queries<
|
|||
aliases::person1.fields(person::all_columns),
|
||||
comment_aggregates::all_columns,
|
||||
community_person_ban::id.nullable().is_not_null(),
|
||||
community_moderator::id.nullable().is_not_null(),
|
||||
CommunityFollower::select_subscribed_type(),
|
||||
comment_saved::id.nullable().is_not_null(),
|
||||
person_block::id.nullable().is_not_null(),
|
||||
|
@ -105,6 +107,13 @@ fn queries<'a>() -> Queries<
|
|||
.and(community_person_ban::person_id.eq(comment::creator_id)),
|
||||
),
|
||||
)
|
||||
.left_join(
|
||||
community_moderator::table.on(
|
||||
community::id
|
||||
.eq(community_moderator::community_id)
|
||||
.and(community_moderator::person_id.eq(comment::creator_id)),
|
||||
),
|
||||
)
|
||||
.select(selection)
|
||||
.first::<PersonMentionView>(&mut conn)
|
||||
.await
|
||||
|
@ -124,6 +133,13 @@ fn queries<'a>() -> Queries<
|
|||
),
|
||||
),
|
||||
)
|
||||
.left_join(
|
||||
community_moderator::table.on(
|
||||
community::id
|
||||
.eq(community_moderator::community_id)
|
||||
.and(community_moderator::person_id.eq(comment::creator_id)),
|
||||
),
|
||||
)
|
||||
.select(selection);
|
||||
|
||||
if let Some(recipient_id) = options.recipient_id {
|
||||
|
|
|
@ -99,6 +99,7 @@ pub struct PersonMentionView {
|
|||
pub recipient: Person,
|
||||
pub counts: CommentAggregates,
|
||||
pub creator_banned_from_community: bool,
|
||||
pub creator_is_moderator: bool,
|
||||
pub subscribed: SubscribedType,
|
||||
pub saved: bool,
|
||||
pub creator_blocked: bool,
|
||||
|
@ -118,11 +119,12 @@ pub struct CommentReplyView {
|
|||
pub community: Community,
|
||||
pub recipient: Person,
|
||||
pub counts: CommentAggregates,
|
||||
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
||||
pub subscribed: SubscribedType, // Left join to CommunityFollower
|
||||
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 creator_banned_from_community: bool,
|
||||
pub creator_is_moderator: bool,
|
||||
pub subscribed: SubscribedType,
|
||||
pub saved: bool,
|
||||
pub creator_blocked: bool,
|
||||
pub my_vote: Option<i16>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
|
|
Loading…
Reference in a new issue