X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fdb_views%2Fsrc%2Fcomment_view.rs;h=6dcda899bea19f550b1c6f77cd9bdcb205062c75;hb=e65c45f15272b5f43053a214600ee3b8cebffc0d;hp=4fdd409705619d1d82c7ee618cbb59e8fc2cc10a;hpb=41b90bb162f172b289470368c169fffb69106658;p=lemmy.git diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 4fdd4097..6dcda899 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -1,4 +1,4 @@ -use diesel::{result::Error, *}; +use diesel::{dsl::*, result::Error, *}; use lemmy_db_schema::{ aggregates::comment_aggregates::CommentAggregates, functions::hot_rank, @@ -98,7 +98,12 @@ impl CommentView { community_person_ban::table.on( community::id .eq(community_person_ban::community_id) - .and(community_person_ban::person_id.eq(comment::creator_id)), + .and(community_person_ban::person_id.eq(comment::creator_id)) + .and( + community_person_ban::expires + .is_null() + .or(community_person_ban::expires.gt(now)), + ), ), ) .left_join( @@ -345,7 +350,12 @@ impl<'a> CommentQueryBuilder<'a> { community_person_ban::table.on( community::id .eq(community_person_ban::community_id) - .and(community_person_ban::person_id.eq(comment::creator_id)), + .and(community_person_ban::person_id.eq(comment::creator_id)) + .and( + community_person_ban::expires + .is_null() + .or(community_person_ban::expires.gt(now)), + ), ), ) .left_join( @@ -646,6 +656,7 @@ mod tests { inbox_url: inserted_person.inbox_url.to_owned(), shared_inbox_url: None, matrix_user_id: None, + ban_expires: None, }, recipient: None, post: Post {