Dropping default on pending column.

expose_pending
Dessalines 2022-05-17 14:02:48 -04:00 committed by Nutomic
parent d4ee171b08
commit 3c111b3062
12 changed files with 15 additions and 15 deletions

View File

@ -76,7 +76,7 @@ impl Perform for BanFromCommunity {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: data.community_id, community_id: data.community_id,
person_id: banned_person_id, person_id: banned_person_id,
pending: Some(false), pending: false,
}; };
blocking(context.pool(), move |conn: &'_ _| { blocking(context.pool(), move |conn: &'_ _| {
CommunityFollower::unfollow(conn, &community_follower_form) CommunityFollower::unfollow(conn, &community_follower_form)

View File

@ -47,7 +47,7 @@ impl Perform for BlockCommunity {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: data.community_id, community_id: data.community_id,
person_id, person_id,
pending: Some(false), pending: false,
}; };
blocking(context.pool(), move |conn: &'_ _| { blocking(context.pool(), move |conn: &'_ _| {
CommunityFollower::unfollow(conn, &community_follower_form) CommunityFollower::unfollow(conn, &community_follower_form)

View File

@ -47,7 +47,7 @@ impl Perform for FollowCommunity {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: data.community_id, community_id: data.community_id,
person_id: local_user_view.person.id, person_id: local_user_view.person.id,
pending: Some(false), // Don't worry, this form isn't used for remote follows pending: false, // Don't worry, this form isn't used for remote follows
}; };
if community.local { if community.local {

View File

@ -123,7 +123,7 @@ impl PerformCrud for CreateCommunity {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: inserted_community.id, community_id: inserted_community.id,
person_id: local_user_view.person.id, person_id: local_user_view.person.id,
pending: Some(false), pending: false,
}; };
let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form); let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);

View File

@ -232,7 +232,7 @@ impl PerformCrud for Register {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: main_community.id, community_id: main_community.id,
person_id: inserted_person.id, person_id: inserted_person.id,
pending: Some(false), pending: false,
}; };
let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form); let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);

View File

@ -200,7 +200,7 @@ impl ActivityHandler for BlockUser {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: community.id, community_id: community.id,
person_id: blocked_person.id, person_id: blocked_person.id,
pending: Some(false), pending: false,
}; };
blocking(context.pool(), move |conn: &'_ _| { blocking(context.pool(), move |conn: &'_ _| {
CommunityFollower::unfollow(conn, &community_follower_form) CommunityFollower::unfollow(conn, &community_follower_form)

View File

@ -50,7 +50,7 @@ impl FollowCommunity {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: community.id, community_id: community.id,
person_id: actor.id, person_id: actor.id,
pending: Some(true), pending: true,
}; };
blocking(context.pool(), move |conn| { blocking(context.pool(), move |conn| {
CommunityFollower::follow(conn, &community_follower_form).ok() CommunityFollower::follow(conn, &community_follower_form).ok()
@ -100,7 +100,7 @@ impl ActivityHandler for FollowCommunity {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: community.id, community_id: community.id,
person_id: person.id, person_id: person.id,
pending: Some(false), pending: false,
}; };
// This will fail if they're already a follower, but ignore the error. // This will fail if they're already a follower, but ignore the error.

View File

@ -77,7 +77,7 @@ impl ActivityHandler for UndoFollowCommunity {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: community.id, community_id: community.id,
person_id: person.id, person_id: person.id,
pending: Some(false), pending: false,
}; };
// This will fail if they aren't a follower, but ignore the error. // This will fail if they aren't a follower, but ignore the error.

View File

@ -66,7 +66,7 @@ mod tests {
let first_person_follow = CommunityFollowerForm { let first_person_follow = CommunityFollowerForm {
community_id: inserted_community.id, community_id: inserted_community.id,
person_id: inserted_person.id, person_id: inserted_person.id,
pending: Some(false), pending: false,
}; };
CommunityFollower::follow(&conn, &first_person_follow).unwrap(); CommunityFollower::follow(&conn, &first_person_follow).unwrap();
@ -74,7 +74,7 @@ mod tests {
let second_person_follow = CommunityFollowerForm { let second_person_follow = CommunityFollowerForm {
community_id: inserted_community.id, community_id: inserted_community.id,
person_id: another_inserted_person.id, person_id: another_inserted_person.id,
pending: Some(false), pending: false,
}; };
CommunityFollower::follow(&conn, &second_person_follow).unwrap(); CommunityFollower::follow(&conn, &second_person_follow).unwrap();
@ -82,7 +82,7 @@ mod tests {
let another_community_follow = CommunityFollowerForm { let another_community_follow = CommunityFollowerForm {
community_id: another_inserted_community.id, community_id: another_inserted_community.id,
person_id: inserted_person.id, person_id: inserted_person.id,
pending: Some(false), pending: false,
}; };
CommunityFollower::follow(&conn, &another_community_follow).unwrap(); CommunityFollower::follow(&conn, &another_community_follow).unwrap();

View File

@ -380,7 +380,7 @@ mod tests {
let community_follower_form = CommunityFollowerForm { let community_follower_form = CommunityFollowerForm {
community_id: inserted_community.id, community_id: inserted_community.id,
person_id: inserted_person.id, person_id: inserted_person.id,
pending: Some(false), pending: false,
}; };
let inserted_community_follower = let inserted_community_follower =

View File

@ -137,5 +137,5 @@ pub struct CommunityFollower {
pub struct CommunityFollowerForm { pub struct CommunityFollowerForm {
pub community_id: CommunityId, pub community_id: CommunityId,
pub person_id: PersonId, pub person_id: PersonId,
pub pending: Option<bool>, pub pending: bool,
} }

View File

@ -4,5 +4,5 @@ update community_follower set pending = true where pending is null;
alter table community_follower alter table community_follower
alter column pending set not null, alter column pending set not null,
alter column pending set default true; alter column pending drop default;