-use diesel::{result::Error, *};
+use diesel::{dsl::*, result::Error, *};
use lemmy_db_schema::{
aggregates::post_aggregates::PostAggregates,
limit_and_offset,
community_person_ban::table.on(
post::community_id
.eq(community_person_ban::community_id)
- .and(community_person_ban::person_id.eq(post::creator_id)),
+ .and(community_person_ban::person_id.eq(post::creator_id))
+ .and(
+ community_person_ban::expires
+ .is_null()
+ .or(community_person_ban::expires.gt(now)),
+ ),
),
)
.left_join(
community_person_ban::table.on(
post::community_id
.eq(community_person_ban::community_id)
- .and(community_person_ban::person_id.eq(post::creator_id)),
+ .and(community_person_ban::person_id.eq(post::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,
},
post_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,
my_vote: None,
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!(