mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 03:41:02 +00:00
Merge remote-tracking branch 'yerba/main' into main
This commit is contained in:
commit
3301e0ba50
6 changed files with 2 additions and 21 deletions
|
@ -151,11 +151,9 @@ mod tests {
|
||||||
};
|
};
|
||||||
|
|
||||||
let read_activity = Activity::read(&conn, inserted_activity.id).unwrap();
|
let read_activity = Activity::read(&conn, inserted_activity.id).unwrap();
|
||||||
let num_deleted = Activity::delete(&conn, inserted_activity.id).unwrap();
|
|
||||||
User_::delete(&conn, inserted_creator.id).unwrap();
|
User_::delete(&conn, inserted_creator.id).unwrap();
|
||||||
|
|
||||||
assert_eq!(expected_activity, read_activity);
|
assert_eq!(expected_activity, read_activity);
|
||||||
assert_eq!(expected_activity, inserted_activity);
|
assert_eq!(expected_activity, inserted_activity);
|
||||||
assert_eq!(1, num_deleted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,10 +159,7 @@ impl Comment {
|
||||||
.get_result::<Self>(conn)
|
.get_result::<Self>(conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn upsert(
|
pub fn upsert(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> {
|
||||||
conn: &PgConnection,
|
|
||||||
comment_form: &CommentForm,
|
|
||||||
) -> Result<Self, Error> {
|
|
||||||
let existing = Self::read_from_apub_id(conn, &comment_form.ap_id);
|
let existing = Self::read_from_apub_id(conn, &comment_form.ap_id);
|
||||||
match existing {
|
match existing {
|
||||||
Err(NotFound {}) => Ok(Self::create(conn, &comment_form)?),
|
Err(NotFound {}) => Ok(Self::create(conn, &comment_form)?),
|
||||||
|
|
|
@ -251,7 +251,7 @@ impl<'a> CommunityQueryBuilder<'a> {
|
||||||
.order_by(hot_rank.desc())
|
.order_by(hot_rank.desc())
|
||||||
.then_order_by(number_of_subscribers.desc())
|
.then_order_by(number_of_subscribers.desc())
|
||||||
.filter(user_id.is_null())
|
.filter(user_id.is_null())
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if !self.show_nsfw {
|
if !self.show_nsfw {
|
||||||
|
|
|
@ -707,16 +707,6 @@ mod tests {
|
||||||
when_: inserted_mod_add.when_,
|
when_: inserted_mod_add.when_,
|
||||||
};
|
};
|
||||||
|
|
||||||
ModRemovePost::delete(&conn, inserted_mod_remove_post.id).unwrap();
|
|
||||||
ModLockPost::delete(&conn, inserted_mod_lock_post.id).unwrap();
|
|
||||||
ModStickyPost::delete(&conn, inserted_mod_sticky_post.id).unwrap();
|
|
||||||
ModRemoveComment::delete(&conn, inserted_mod_remove_comment.id).unwrap();
|
|
||||||
ModRemoveCommunity::delete(&conn, inserted_mod_remove_community.id).unwrap();
|
|
||||||
ModBanFromCommunity::delete(&conn, inserted_mod_ban_from_community.id).unwrap();
|
|
||||||
ModBan::delete(&conn, inserted_mod_ban.id).unwrap();
|
|
||||||
ModAddCommunity::delete(&conn, inserted_mod_add_community.id).unwrap();
|
|
||||||
ModAdd::delete(&conn, inserted_mod_add.id).unwrap();
|
|
||||||
|
|
||||||
Comment::delete(&conn, inserted_comment.id).unwrap();
|
Comment::delete(&conn, inserted_comment.id).unwrap();
|
||||||
Post::delete(&conn, inserted_post.id).unwrap();
|
Post::delete(&conn, inserted_post.id).unwrap();
|
||||||
Community::delete(&conn, inserted_community.id).unwrap();
|
Community::delete(&conn, inserted_community.id).unwrap();
|
||||||
|
|
|
@ -225,7 +225,6 @@ mod tests {
|
||||||
PrivateMessage::update_deleted(&conn, inserted_private_message.id, true).unwrap();
|
PrivateMessage::update_deleted(&conn, inserted_private_message.id, true).unwrap();
|
||||||
let marked_read_private_message =
|
let marked_read_private_message =
|
||||||
PrivateMessage::update_read(&conn, inserted_private_message.id, true).unwrap();
|
PrivateMessage::update_read(&conn, inserted_private_message.id, true).unwrap();
|
||||||
let num_deleted = PrivateMessage::delete(&conn, inserted_private_message.id).unwrap();
|
|
||||||
User_::delete(&conn, inserted_creator.id).unwrap();
|
User_::delete(&conn, inserted_creator.id).unwrap();
|
||||||
User_::delete(&conn, inserted_recipient.id).unwrap();
|
User_::delete(&conn, inserted_recipient.id).unwrap();
|
||||||
|
|
||||||
|
@ -234,6 +233,5 @@ mod tests {
|
||||||
assert_eq!(expected_private_message, inserted_private_message);
|
assert_eq!(expected_private_message, inserted_private_message);
|
||||||
assert!(deleted_private_message.deleted);
|
assert!(deleted_private_message.deleted);
|
||||||
assert!(marked_read_private_message.read);
|
assert!(marked_read_private_message.read);
|
||||||
assert_eq!(1, num_deleted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,6 @@ mod tests {
|
||||||
let read_mention = UserMention::read(&conn, inserted_mention.id).unwrap();
|
let read_mention = UserMention::read(&conn, inserted_mention.id).unwrap();
|
||||||
let updated_mention =
|
let updated_mention =
|
||||||
UserMention::update(&conn, inserted_mention.id, &user_mention_form).unwrap();
|
UserMention::update(&conn, inserted_mention.id, &user_mention_form).unwrap();
|
||||||
let num_deleted = UserMention::delete(&conn, inserted_mention.id).unwrap();
|
|
||||||
Comment::delete(&conn, inserted_comment.id).unwrap();
|
Comment::delete(&conn, inserted_comment.id).unwrap();
|
||||||
Post::delete(&conn, inserted_post.id).unwrap();
|
Post::delete(&conn, inserted_post.id).unwrap();
|
||||||
Community::delete(&conn, inserted_community.id).unwrap();
|
Community::delete(&conn, inserted_community.id).unwrap();
|
||||||
|
@ -234,6 +233,5 @@ mod tests {
|
||||||
assert_eq!(expected_mention, read_mention);
|
assert_eq!(expected_mention, read_mention);
|
||||||
assert_eq!(expected_mention, inserted_mention);
|
assert_eq!(expected_mention, inserted_mention);
|
||||||
assert_eq!(expected_mention, updated_mention);
|
assert_eq!(expected_mention, updated_mention);
|
||||||
assert_eq!(1, num_deleted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue