Renaming ignore to unfollow in followable trait.

This commit is contained in:
Dessalines 2020-05-04 14:26:16 -04:00
parent b8b2398d32
commit b177cbce1d
4 changed files with 6 additions and 6 deletions

View file

@ -495,7 +495,7 @@ impl Perform for Oper<FollowCommunity> {
Err(_e) => return Err(APIError::err("community_follower_already_exists").into()),
};
} else {
match CommunityFollower::ignore(&conn, &community_follower_form) {
match CommunityFollower::unfollow(&conn, &community_follower_form) {
Ok(user) => user,
Err(_e) => return Err(APIError::err("community_follower_already_exists").into()),
};
@ -509,7 +509,7 @@ impl Perform for Oper<FollowCommunity> {
user.send_follow(&community.actor_id, &conn)?;
} else {
user.send_unfollow(&community.actor_id, &conn)?;
match CommunityFollower::ignore(&conn, &community_follower_form) {
match CommunityFollower::unfollow(&conn, &community_follower_form) {
Ok(user) => user,
Err(_e) => return Err(APIError::err("community_follower_already_exists").into()),
};

View file

@ -129,7 +129,7 @@ fn handle_undo_follow(
user_id: user.id,
};
CommunityFollower::ignore(&conn, &community_follower_form).ok();
CommunityFollower::unfollow(&conn, &community_follower_form).ok();
Ok(HttpResponse::Ok().finish())
}

View file

@ -216,7 +216,7 @@ impl Followable<CommunityFollowerForm> for CommunityFollower {
.values(community_follower_form)
.get_result::<Self>(conn)
}
fn ignore(
fn unfollow(
conn: &PgConnection,
community_follower_form: &CommunityFollowerForm,
) -> Result<usize, Error> {
@ -351,7 +351,7 @@ mod tests {
let read_community = Community::read(&conn, inserted_community.id).unwrap();
let updated_community =
Community::update(&conn, inserted_community.id, &new_community).unwrap();
let ignored_community = CommunityFollower::ignore(&conn, &community_follower_form).unwrap();
let ignored_community = CommunityFollower::unfollow(&conn, &community_follower_form).unwrap();
let left_community = CommunityModerator::leave(&conn, &community_user_form).unwrap();
let unban = CommunityUserBan::unban(&conn, &community_user_ban_form).unwrap();
let num_deleted = Community::delete(&conn, inserted_community.id).unwrap();

View file

@ -44,7 +44,7 @@ pub trait Followable<T> {
fn follow(conn: &PgConnection, form: &T) -> Result<Self, Error>
where
Self: Sized;
fn ignore(conn: &PgConnection, form: &T) -> Result<usize, Error>
fn unfollow(conn: &PgConnection, form: &T) -> Result<usize, Error>
where
Self: Sized;
}