mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-25 01:10:32 +00:00
CommunityPersonBanAdditionalInfo (partial)
This commit is contained in:
parent
603aede7ce
commit
158f7f0cd9
8 changed files with 35 additions and 12 deletions
|
@ -11,6 +11,7 @@ use crate::{
|
||||||
CommunityModerator,
|
CommunityModerator,
|
||||||
CommunityModeratorForm,
|
CommunityModeratorForm,
|
||||||
CommunityPersonBan,
|
CommunityPersonBan,
|
||||||
|
CommunityPersonBanAdditionalInfo,
|
||||||
CommunityPersonBanForm,
|
CommunityPersonBanForm,
|
||||||
CommunityUpdateForm,
|
CommunityUpdateForm,
|
||||||
},
|
},
|
||||||
|
@ -214,6 +215,18 @@ impl Bannable for CommunityPersonBan {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CommunityPersonBanAdditionalInfo {
|
||||||
|
pub fn into_full(self, community_id: CommunityId, person_id: PersonId) -> CommunityPersonBan {
|
||||||
|
CommunityPersonBan {
|
||||||
|
id: self.id,
|
||||||
|
published: self.published,
|
||||||
|
expires: self.expires,
|
||||||
|
community_id,
|
||||||
|
person_id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl CommunityFollower {
|
impl CommunityFollower {
|
||||||
pub fn to_subscribed_type(follower: &Option<Self>) -> SubscribedType {
|
pub fn to_subscribed_type(follower: &Option<Self>) -> SubscribedType {
|
||||||
match follower {
|
match follower {
|
||||||
|
|
|
@ -162,6 +162,16 @@ pub struct CommunityPersonBan {
|
||||||
pub expires: Option<chrono::NaiveDateTime>,
|
pub expires: Option<chrono::NaiveDateTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq, Eq, Debug)]
|
||||||
|
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||||
|
#[cfg_attr(feature = "full", diesel(table_name = community_person_ban))]
|
||||||
|
/// Like `CommunityPersonBan` but without `community_id` and `person_id`, which are usually already known
|
||||||
|
pub struct CommunityPersonBanAdditionalInfo {
|
||||||
|
pub id: i32,
|
||||||
|
pub published: chrono::NaiveDateTime,
|
||||||
|
pub expires: Option<chrono::NaiveDateTime>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = community_person_ban))]
|
#[cfg_attr(feature = "full", diesel(table_name = community_person_ban))]
|
||||||
|
|
|
@ -72,7 +72,7 @@ fn queries<'a>() -> Queries<
|
||||||
person::all_columns,
|
person::all_columns,
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(person::all_columns),
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::all_columns.nullable(),
|
CommunityPersonBanAdditionalInfo::as_select().nullable(),
|
||||||
comment_like::score.nullable(),
|
comment_like::score.nullable(),
|
||||||
aliases::person2.fields(person::all_columns).nullable(),
|
aliases::person2.fields(person::all_columns).nullable(),
|
||||||
);
|
);
|
||||||
|
@ -229,7 +229,7 @@ impl JoinView for CommentReportView {
|
||||||
Person,
|
Person,
|
||||||
Person,
|
Person,
|
||||||
CommentAggregatesNotInComment,
|
CommentAggregatesNotInComment,
|
||||||
Option<CommunityPersonBan>,
|
Option<CommunityPersonBanAdditionalInfo>,
|
||||||
Option<i16>,
|
Option<i16>,
|
||||||
Option<Person>,
|
Option<Person>,
|
||||||
);
|
);
|
||||||
|
|
|
@ -48,7 +48,7 @@ type CommentViewTuple = (
|
||||||
Post,
|
Post,
|
||||||
Community,
|
Community,
|
||||||
CommentAggregatesNotInComment,
|
CommentAggregatesNotInComment,
|
||||||
Option<CommunityPersonBan>,
|
Option<CommunityPersonBanAdditionalInfo>,
|
||||||
Option<CommunityFollower>,
|
Option<CommunityFollower>,
|
||||||
Option<CommentSaved>,
|
Option<CommentSaved>,
|
||||||
Option<PersonBlock>,
|
Option<PersonBlock>,
|
||||||
|
@ -110,7 +110,7 @@ fn queries<'a>() -> Queries<
|
||||||
post::all_columns,
|
post::all_columns,
|
||||||
community::all_columns,
|
community::all_columns,
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::all_columns.nullable(),
|
CommunityPersonBanAdditionalInfo::as_select().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(),
|
person_block::all_columns.nullable(),
|
||||||
|
|
|
@ -40,7 +40,7 @@ type PostReportViewTuple = (
|
||||||
Community,
|
Community,
|
||||||
Person,
|
Person,
|
||||||
Person,
|
Person,
|
||||||
Option<CommunityPersonBan>,
|
Option<CommunityPersonBanAdditionalInfo>,
|
||||||
Option<i16>,
|
Option<i16>,
|
||||||
PostAggregatesNotInPost,
|
PostAggregatesNotInPost,
|
||||||
Option<Person>,
|
Option<Person>,
|
||||||
|
@ -81,7 +81,7 @@ fn queries<'a>() -> Queries<
|
||||||
community::all_columns,
|
community::all_columns,
|
||||||
person::all_columns,
|
person::all_columns,
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(person::all_columns),
|
||||||
community_person_ban::all_columns.nullable(),
|
CommunityPersonBanAdditionalInfo::as_select().nullable(),
|
||||||
post_like::score.nullable(),
|
post_like::score.nullable(),
|
||||||
PostAggregatesNotInPost::as_select(),
|
PostAggregatesNotInPost::as_select(),
|
||||||
aliases::person2.fields(person::all_columns.nullable()),
|
aliases::person2.fields(person::all_columns.nullable()),
|
||||||
|
|
|
@ -51,7 +51,7 @@ type PostViewTuple = (
|
||||||
Post,
|
Post,
|
||||||
Person,
|
Person,
|
||||||
Community,
|
Community,
|
||||||
Option<CommunityPersonBan>,
|
Option<CommunityPersonBanAdditionalInfo>,
|
||||||
PostAggregatesNotInPost,
|
PostAggregatesNotInPost,
|
||||||
Option<CommunityFollower>,
|
Option<CommunityFollower>,
|
||||||
Option<PostSaved>,
|
Option<PostSaved>,
|
||||||
|
@ -137,7 +137,7 @@ fn queries<'a>() -> Queries<
|
||||||
post::all_columns,
|
post::all_columns,
|
||||||
person::all_columns,
|
person::all_columns,
|
||||||
community::all_columns,
|
community::all_columns,
|
||||||
community_person_ban::all_columns.nullable(),
|
CommunityPersonBanAdditionalInfo::as_select().nullable(),
|
||||||
PostAggregatesNotInPost::as_select(),
|
PostAggregatesNotInPost::as_select(),
|
||||||
community_follower::all_columns.nullable(),
|
community_follower::all_columns.nullable(),
|
||||||
post_saved::all_columns.nullable(),
|
post_saved::all_columns.nullable(),
|
||||||
|
|
|
@ -48,7 +48,7 @@ type CommentReplyViewTuple = (
|
||||||
Community,
|
Community,
|
||||||
Person,
|
Person,
|
||||||
CommentAggregatesNotInComment,
|
CommentAggregatesNotInComment,
|
||||||
Option<CommunityPersonBan>,
|
Option<CommunityPersonBanAdditionalInfo>,
|
||||||
Option<CommunityFollower>,
|
Option<CommunityFollower>,
|
||||||
Option<CommentSaved>,
|
Option<CommentSaved>,
|
||||||
Option<PersonBlock>,
|
Option<PersonBlock>,
|
||||||
|
@ -113,7 +113,7 @@ fn queries<'a>() -> Queries<
|
||||||
community::all_columns,
|
community::all_columns,
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(person::all_columns),
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::all_columns.nullable(),
|
CommunityPersonBanAdditionalInfo::as_select().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(),
|
person_block::all_columns.nullable(),
|
||||||
|
|
|
@ -49,7 +49,7 @@ type PersonMentionViewTuple = (
|
||||||
Community,
|
Community,
|
||||||
Person,
|
Person,
|
||||||
CommentAggregatesNotInComment,
|
CommentAggregatesNotInComment,
|
||||||
Option<CommunityPersonBan>,
|
Option<CommunityPersonBanAdditionalInfo>,
|
||||||
Option<CommunityFollower>,
|
Option<CommunityFollower>,
|
||||||
Option<CommentSaved>,
|
Option<CommentSaved>,
|
||||||
Option<PersonBlock>,
|
Option<PersonBlock>,
|
||||||
|
@ -109,7 +109,7 @@ fn queries<'a>() -> Queries<
|
||||||
community::all_columns,
|
community::all_columns,
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(person::all_columns),
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::all_columns.nullable(),
|
CommunityPersonBanAdditionalInfo::as_select().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(),
|
person_block::all_columns.nullable(),
|
||||||
|
|
Loading…
Reference in a new issue