post_id: PostId,
my_person_id: Option<PersonId>,
) -> Result<Self, Error> {
post_id: PostId,
my_person_id: Option<PersonId>,
) -> Result<Self, Error> {
listing_type: Option<ListingType>,
sort: Option<SortType>,
creator_id: Option<PersonId>,
listing_type: Option<ListingType>,
sort: Option<SortType>,
creator_id: Option<PersonId>,
let local_user_form = LocalUserForm {
show_bot_accounts: Some(false),
..Default::default()
};
let inserted_local_user =
let local_user_form = LocalUserForm {
show_bot_accounts: Some(false),
..Default::default()
};
let inserted_local_user =
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&inserted_local_user))
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&inserted_local_user))
// Should be only one person, IE the bot post, and blocked should be missing
assert_eq!(1, read_post_listing.len());
// Should be only one person, IE the bot post, and blocked should be missing
assert_eq!(1, read_post_listing.len());
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&inserted_local_user))
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&inserted_local_user))
// should include bot post which has "undetermined" language
assert_eq!(2, post_listings_with_bots.len());
// should include bot post which has "undetermined" language
assert_eq!(2, post_listings_with_bots.len());
// Should be 2 posts, with the bot post, and the blocked
assert_eq!(3, read_post_listing_multiple_no_person.len());
// Should be 2 posts, with the bot post, and the blocked
assert_eq!(3, read_post_listing_multiple_no_person.len());
let community_block = CommunityBlockForm {
person_id: data.inserted_person.id,
community_id: data.inserted_community.id,
};
let community_block = CommunityBlockForm {
person_id: data.inserted_person.id,
community_id: data.inserted_community.id,
};
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&data.inserted_local_user))
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&data.inserted_local_user))
// Should be 0 posts after the community block
assert_eq!(0, read_post_listings_with_person_after_block.len());
// Should be 0 posts after the community block
assert_eq!(0, read_post_listings_with_person_after_block.len());
let post_like_form = PostLikeForm {
post_id: data.inserted_post.id,
let post_like_form = PostLikeForm {
post_id: data.inserted_post.id,
let expected_post_like = PostLike {
id: inserted_post_like.id,
let expected_post_like = PostLike {
id: inserted_post_like.id,
let post_spanish = PostForm {
name: "asffgdsc".to_string(),
creator_id: data.inserted_person.id,
let post_spanish = PostForm {
name: "asffgdsc".to_string(),
creator_id: data.inserted_person.id,
// no language filters specified, all posts should be returned
assert_eq!(3, post_listings_all.len());
// no language filters specified, all posts should be returned
assert_eq!(3, post_listings_all.len());
Some(vec![french_id]),
data.inserted_local_user.id,
)
.unwrap();
let post_listing_french = PostQuery::builder()
Some(vec![french_id]),
data.inserted_local_user.id,
)
.unwrap();
let post_listing_french = PostQuery::builder()
assert_eq!(1, post_listing_french.len());
assert_eq!(french_id, post_listing_french[0].post.language_id);
assert_eq!(1, post_listing_french.len());
assert_eq!(french_id, post_listing_french[0].post.language_id);
Some(vec![french_id, undetermined_id]),
data.inserted_local_user.id,
)
.unwrap();
let post_listings_french_und = PostQuery::builder()
Some(vec![french_id, undetermined_id]),
data.inserted_local_user.id,
)
.unwrap();
let post_listings_french_und = PostQuery::builder()
let num_deleted = Post::delete(conn, data.inserted_post.id).unwrap();
Community::delete(conn, data.inserted_community.id).unwrap();
Person::delete(conn, data.inserted_person.id).unwrap();
let num_deleted = Post::delete(conn, data.inserted_post.id).unwrap();
Community::delete(conn, data.inserted_community.id).unwrap();
Person::delete(conn, data.inserted_person.id).unwrap();
let (inserted_person, inserted_community, inserted_post) = (
&data.inserted_person,
&data.inserted_community,
let (inserted_person, inserted_community, inserted_post) = (
&data.inserted_person,
&data.inserted_community,