From 79a6bf003e30b837033b657ddf96e96e4ad09339 Mon Sep 17 00:00:00 2001 From: dull b Date: Sat, 29 Jul 2023 01:55:53 +0000 Subject: [PATCH] Revert "CommunityPersonBanAdditionalInfo (partial)" This reverts commit 158f7f0cd9a07392fb1f457ac43c8d7c57e4190d. --- crates/db_schema/src/impls/community.rs | 13 ------------- crates/db_schema/src/source/community.rs | 10 ---------- crates/db_views/src/comment_report_view.rs | 4 ++-- crates/db_views/src/comment_view.rs | 4 ++-- crates/db_views/src/post_report_view.rs | 4 ++-- crates/db_views/src/post_view.rs | 4 ++-- crates/db_views_actor/src/comment_reply_view.rs | 4 ++-- crates/db_views_actor/src/person_mention_view.rs | 4 ++-- 8 files changed, 12 insertions(+), 35 deletions(-) diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index 032bce202..258e41504 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -11,7 +11,6 @@ use crate::{ CommunityModerator, CommunityModeratorForm, CommunityPersonBan, - CommunityPersonBanAdditionalInfo, CommunityPersonBanForm, CommunityUpdateForm, }, @@ -215,18 +214,6 @@ 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 { pub fn to_subscribed_type(follower: &Option) -> SubscribedType { match follower { diff --git a/crates/db_schema/src/source/community.rs b/crates/db_schema/src/source/community.rs index 6d8ba50be..64b30b2a8 100644 --- a/crates/db_schema/src/source/community.rs +++ b/crates/db_schema/src/source/community.rs @@ -162,16 +162,6 @@ pub struct CommunityPersonBan { pub expires: Option, } -#[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, -} - #[derive(Clone)] #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))] #[cfg_attr(feature = "full", diesel(table_name = community_person_ban))] diff --git a/crates/db_views/src/comment_report_view.rs b/crates/db_views/src/comment_report_view.rs index 505a01797..3ee3934b5 100644 --- a/crates/db_views/src/comment_report_view.rs +++ b/crates/db_views/src/comment_report_view.rs @@ -72,7 +72,7 @@ fn queries<'a>() -> Queries< person::all_columns, aliases::person1.fields(person::all_columns), CommentAggregatesNotInComment::as_select(), - CommunityPersonBanAdditionalInfo::as_select().nullable(), + community_person_ban::all_columns.nullable(), comment_like::score.nullable(), aliases::person2.fields(person::all_columns).nullable(), ); @@ -229,7 +229,7 @@ impl JoinView for CommentReportView { Person, Person, CommentAggregatesNotInComment, - Option, + Option, Option, Option, ); diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 4f1b15f0e..f126bfd2a 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -48,7 +48,7 @@ type CommentViewTuple = ( Post, Community, CommentAggregatesNotInComment, - Option, + Option, Option, Option, Option, @@ -110,7 +110,7 @@ fn queries<'a>() -> Queries< post::all_columns, community::all_columns, CommentAggregatesNotInComment::as_select(), - CommunityPersonBanAdditionalInfo::as_select().nullable(), + community_person_ban::all_columns.nullable(), community_follower::all_columns.nullable(), comment_saved::all_columns.nullable(), person_block::all_columns.nullable(), diff --git a/crates/db_views/src/post_report_view.rs b/crates/db_views/src/post_report_view.rs index b1ac4142c..2d31fd0b2 100644 --- a/crates/db_views/src/post_report_view.rs +++ b/crates/db_views/src/post_report_view.rs @@ -40,7 +40,7 @@ type PostReportViewTuple = ( Community, Person, Person, - Option, + Option, Option, PostAggregatesNotInPost, Option, @@ -81,7 +81,7 @@ fn queries<'a>() -> Queries< community::all_columns, person::all_columns, aliases::person1.fields(person::all_columns), - CommunityPersonBanAdditionalInfo::as_select().nullable(), + community_person_ban::all_columns.nullable(), post_like::score.nullable(), PostAggregatesNotInPost::as_select(), aliases::person2.fields(person::all_columns.nullable()), diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index 33870eff6..519463265 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -51,7 +51,7 @@ type PostViewTuple = ( Post, Person, Community, - Option, + Option, PostAggregatesNotInPost, Option, Option, @@ -137,7 +137,7 @@ fn queries<'a>() -> Queries< post::all_columns, person::all_columns, community::all_columns, - CommunityPersonBanAdditionalInfo::as_select().nullable(), + community_person_ban::all_columns.nullable(), PostAggregatesNotInPost::as_select(), community_follower::all_columns.nullable(), post_saved::all_columns.nullable(), diff --git a/crates/db_views_actor/src/comment_reply_view.rs b/crates/db_views_actor/src/comment_reply_view.rs index 6d993dbf2..3c2ce07fc 100644 --- a/crates/db_views_actor/src/comment_reply_view.rs +++ b/crates/db_views_actor/src/comment_reply_view.rs @@ -48,7 +48,7 @@ type CommentReplyViewTuple = ( Community, Person, CommentAggregatesNotInComment, - Option, + Option, Option, Option, Option, @@ -113,7 +113,7 @@ fn queries<'a>() -> Queries< community::all_columns, aliases::person1.fields(person::all_columns), CommentAggregatesNotInComment::as_select(), - CommunityPersonBanAdditionalInfo::as_select().nullable(), + community_person_ban::all_columns.nullable(), community_follower::all_columns.nullable(), comment_saved::all_columns.nullable(), person_block::all_columns.nullable(), diff --git a/crates/db_views_actor/src/person_mention_view.rs b/crates/db_views_actor/src/person_mention_view.rs index 1b5145c02..08dc9c092 100644 --- a/crates/db_views_actor/src/person_mention_view.rs +++ b/crates/db_views_actor/src/person_mention_view.rs @@ -49,7 +49,7 @@ type PersonMentionViewTuple = ( Community, Person, CommentAggregatesNotInComment, - Option, + Option, Option, Option, Option, @@ -109,7 +109,7 @@ fn queries<'a>() -> Queries< community::all_columns, aliases::person1.fields(person::all_columns), CommentAggregatesNotInComment::as_select(), - CommunityPersonBanAdditionalInfo::as_select().nullable(), + community_person_ban::all_columns.nullable(), community_follower::all_columns.nullable(), comment_saved::all_columns.nullable(), person_block::all_columns.nullable(),