]> Untitled Git - lemmy.git/commitdiff
Dropping default on pending column.
authorDessalines <tyhou13@gmx.com>
Tue, 17 May 2022 18:02:48 +0000 (14:02 -0400)
committerNutomic <me@nutomic.com>
Fri, 20 May 2022 16:15:14 +0000 (16:15 +0000)
12 files changed:
crates/api/src/community/ban.rs
crates/api/src/community/block.rs
crates/api/src/community/follow.rs
crates/api_crud/src/community/create.rs
crates/api_crud/src/user/create.rs
crates/apub/src/activities/block/block_user.rs
crates/apub/src/activities/following/follow.rs
crates/apub/src/activities/following/undo_follow.rs
crates/db_schema/src/aggregates/community_aggregates.rs
crates/db_schema/src/impls/community.rs
crates/db_schema/src/source/community.rs
migrations/2022-05-10-173801_change_pending_to_notnull/up.sql

index f4a727ebe446d42e0c30111db90c9d9a4bffc032..60fd32270f76ae7db7022ea0fa32bbe2e2ba4477 100644 (file)
@@ -76,7 +76,7 @@ impl Perform for BanFromCommunity {
       let community_follower_form = CommunityFollowerForm {
         community_id: data.community_id,
         person_id: banned_person_id,
-        pending: Some(false),
+        pending: false,
       };
       blocking(context.pool(), move |conn: &'_ _| {
         CommunityFollower::unfollow(conn, &community_follower_form)
index a8672e3e2172a52a2090734218ca51d7f23fc97e..4f740c916971182931600786dcfcbb24f000a5e2 100644 (file)
@@ -47,7 +47,7 @@ impl Perform for BlockCommunity {
       let community_follower_form = CommunityFollowerForm {
         community_id: data.community_id,
         person_id,
-        pending: Some(false),
+        pending: false,
       };
       blocking(context.pool(), move |conn: &'_ _| {
         CommunityFollower::unfollow(conn, &community_follower_form)
index 15a56b17b0ba50832beaefbea9bf8e0dd6340fa1..a61383b219316bafccc19b1b2ddfe9702c54d96f 100644 (file)
@@ -47,7 +47,7 @@ impl Perform for FollowCommunity {
     let community_follower_form = CommunityFollowerForm {
       community_id: data.community_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 {
index 451e9bfa0cbfad12b628331df20077359df44a27..a7582d2ec5bbbf138512bd9850f5b8fd2ece64d1 100644 (file)
@@ -123,7 +123,7 @@ impl PerformCrud for CreateCommunity {
     let community_follower_form = CommunityFollowerForm {
       community_id: inserted_community.id,
       person_id: local_user_view.person.id,
-      pending: Some(false),
+      pending: false,
     };
 
     let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
index 6752dcc84344059f217b40c0c25a136be1742107..456617043d7675bb7ae67723d3a008302f575258 100644 (file)
@@ -232,7 +232,7 @@ impl PerformCrud for Register {
     let community_follower_form = CommunityFollowerForm {
       community_id: main_community.id,
       person_id: inserted_person.id,
-      pending: Some(false),
+      pending: false,
     };
 
     let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
index c05f2f87a89d0b8eb2680c3dc7cfc2174c288811..bcab3148ac8b594b0e0e87180a7c28663d00ef44 100644 (file)
@@ -200,7 +200,7 @@ impl ActivityHandler for BlockUser {
         let community_follower_form = CommunityFollowerForm {
           community_id: community.id,
           person_id: blocked_person.id,
-          pending: Some(false),
+          pending: false,
         };
         blocking(context.pool(), move |conn: &'_ _| {
           CommunityFollower::unfollow(conn, &community_follower_form)
index eb70cb91f231f0a8c328590e8b6542b41dfeb651..d46b3dc20f130049faa1ff97259d05bc0dae7a7b 100644 (file)
@@ -50,7 +50,7 @@ impl FollowCommunity {
     let community_follower_form = CommunityFollowerForm {
       community_id: community.id,
       person_id: actor.id,
-      pending: Some(true),
+      pending: true,
     };
     blocking(context.pool(), move |conn| {
       CommunityFollower::follow(conn, &community_follower_form).ok()
@@ -100,7 +100,7 @@ impl ActivityHandler for FollowCommunity {
     let community_follower_form = CommunityFollowerForm {
       community_id: community.id,
       person_id: person.id,
-      pending: Some(false),
+      pending: false,
     };
 
     // This will fail if they're already a follower, but ignore the error.
index f579d2323fdfd06d7288110774c0ca4c62e95a57..f70acdf2725912ebd57cbf041bd3b20ee13accb6 100644 (file)
@@ -77,7 +77,7 @@ impl ActivityHandler for UndoFollowCommunity {
     let community_follower_form = CommunityFollowerForm {
       community_id: community.id,
       person_id: person.id,
-      pending: Some(false),
+      pending: false,
     };
 
     // This will fail if they aren't a follower, but ignore the error.
index fc8cf0b063c40ebd936b4580102af10f937cd273..950e68d3738a121ada292b373c8128af40afd9a9 100644 (file)
@@ -66,7 +66,7 @@ mod tests {
     let first_person_follow = CommunityFollowerForm {
       community_id: inserted_community.id,
       person_id: inserted_person.id,
-      pending: Some(false),
+      pending: false,
     };
 
     CommunityFollower::follow(&conn, &first_person_follow).unwrap();
@@ -74,7 +74,7 @@ mod tests {
     let second_person_follow = CommunityFollowerForm {
       community_id: inserted_community.id,
       person_id: another_inserted_person.id,
-      pending: Some(false),
+      pending: false,
     };
 
     CommunityFollower::follow(&conn, &second_person_follow).unwrap();
@@ -82,7 +82,7 @@ mod tests {
     let another_community_follow = CommunityFollowerForm {
       community_id: another_inserted_community.id,
       person_id: inserted_person.id,
-      pending: Some(false),
+      pending: false,
     };
 
     CommunityFollower::follow(&conn, &another_community_follow).unwrap();
index 18619de6f07dab77c2bc2c9ffc6c5d939ae71b31..073255cdb05c4b95ca14f325269841754ec7c6f1 100644 (file)
@@ -380,7 +380,7 @@ mod tests {
     let community_follower_form = CommunityFollowerForm {
       community_id: inserted_community.id,
       person_id: inserted_person.id,
-      pending: Some(false),
+      pending: false,
     };
 
     let inserted_community_follower =
index 9700e07a610a3bcc6c4c694592f8ffb31519e930..25766b4084743f6e12645f6fcb373ff8ce39db9c 100644 (file)
@@ -137,5 +137,5 @@ pub struct CommunityFollower {
 pub struct CommunityFollowerForm {
   pub community_id: CommunityId,
   pub person_id: PersonId,
-  pub pending: Option<bool>,
+  pub pending: bool,
 }
index c589ac62cef672d8abfe800ee370e5098985233c..659f321bccc52af9dc37c32c9c11c82832781e2c 100644 (file)
@@ -4,5 +4,5 @@ update community_follower set pending = true where pending is null;
 
 alter table community_follower
   alter column pending set not null,
-  alter column pending set default true;
+  alter column pending drop default;