-use diesel::{result::Error, *};
+use diesel::{dsl::*, result::Error, *};
use lemmy_db_schema::{
aggregates::comment_aggregates::CommentAggregates,
limit_and_offset,
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(
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(
inbox_url: inserted_jessica.inbox_url.to_owned(),
shared_inbox_url: None,
matrix_user_id: None,
+ ban_expires: None,
},
comment_creator: PersonSafeAlias1 {
id: inserted_timmy.id,
inbox_url: inserted_timmy.inbox_url.to_owned(),
shared_inbox_url: None,
matrix_user_id: None,
+ ban_expires: None,
},
creator_banned_from_community: false,
counts: CommentAggregates {
inbox_url: inserted_sara.inbox_url.to_owned(),
shared_inbox_url: None,
matrix_user_id: None,
+ ban_expires: None,
};
// Do a batch read of timmys reports
inbox_url: inserted_timmy.inbox_url.to_owned(),
shared_inbox_url: None,
matrix_user_id: None,
+ ban_expires: None,
});
assert_eq!(