]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/impls/moderator.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / db_schema / src / impls / moderator.rs
index fc9b4803884b1878bfbf2fb0d1f285168ed6f2d9..32201b3cf3a62d16c90ef6d0def3dd11d73e95c7 100644 (file)
@@ -16,6 +16,8 @@ use crate::{
     ModBanForm,
     ModBanFromCommunity,
     ModBanFromCommunityForm,
+    ModFeaturePost,
+    ModFeaturePostForm,
     ModHideCommunity,
     ModHideCommunityForm,
     ModLockPost,
@@ -26,8 +28,6 @@ use crate::{
     ModRemoveCommunityForm,
     ModRemovePost,
     ModRemovePostForm,
-    ModStickyPost,
-    ModStickyPostForm,
     ModTransferCommunity,
     ModTransferCommunityForm,
   },
@@ -42,13 +42,13 @@ impl Crud for ModRemovePost {
   type InsertForm = ModRemovePostForm;
   type UpdateForm = ModRemovePostForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_remove_post::dsl::mod_remove_post;
     let conn = &mut get_conn(pool).await?;
     mod_remove_post.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModRemovePostForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModRemovePostForm) -> Result<Self, Error> {
     use crate::schema::mod_remove_post::dsl::mod_remove_post;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_remove_post)
@@ -57,7 +57,11 @@ impl Crud for ModRemovePost {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &ModRemovePostForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &ModRemovePostForm,
+  ) -> Result<Self, Error> {
     use crate::schema::mod_remove_post::dsl::mod_remove_post;
     let conn = &mut get_conn(pool).await?;
     diesel::update(mod_remove_post.find(from_id))
@@ -72,13 +76,13 @@ impl Crud for ModLockPost {
   type InsertForm = ModLockPostForm;
   type UpdateForm = ModLockPostForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_lock_post::dsl::mod_lock_post;
     let conn = &mut get_conn(pool).await?;
     mod_lock_post.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModLockPostForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModLockPostForm) -> Result<Self, Error> {
     use crate::schema::mod_lock_post::dsl::mod_lock_post;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_lock_post)
@@ -87,7 +91,11 @@ impl Crud for ModLockPost {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &ModLockPostForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &ModLockPostForm,
+  ) -> Result<Self, Error> {
     use crate::schema::mod_lock_post::dsl::mod_lock_post;
     let conn = &mut get_conn(pool).await?;
     diesel::update(mod_lock_post.find(from_id))
@@ -98,29 +106,33 @@ impl Crud for ModLockPost {
 }
 
 #[async_trait]
-impl Crud for ModStickyPost {
-  type InsertForm = ModStickyPostForm;
-  type UpdateForm = ModStickyPostForm;
+impl Crud for ModFeaturePost {
+  type InsertForm = ModFeaturePostForm;
+  type UpdateForm = ModFeaturePostForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
-    use crate::schema::mod_sticky_post::dsl::mod_sticky_post;
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
+    use crate::schema::mod_feature_post::dsl::mod_feature_post;
     let conn = &mut get_conn(pool).await?;
-    mod_sticky_post.find(from_id).first::<Self>(conn).await
+    mod_feature_post.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModStickyPostForm) -> Result<Self, Error> {
-    use crate::schema::mod_sticky_post::dsl::mod_sticky_post;
+  async fn create(pool: &mut DbPool<'_>, form: &ModFeaturePostForm) -> Result<Self, Error> {
+    use crate::schema::mod_feature_post::dsl::mod_feature_post;
     let conn = &mut get_conn(pool).await?;
-    insert_into(mod_sticky_post)
+    insert_into(mod_feature_post)
       .values(form)
       .get_result::<Self>(conn)
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &ModStickyPostForm) -> Result<Self, Error> {
-    use crate::schema::mod_sticky_post::dsl::mod_sticky_post;
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &ModFeaturePostForm,
+  ) -> Result<Self, Error> {
+    use crate::schema::mod_feature_post::dsl::mod_feature_post;
     let conn = &mut get_conn(pool).await?;
-    diesel::update(mod_sticky_post.find(from_id))
+    diesel::update(mod_feature_post.find(from_id))
       .set(form)
       .get_result::<Self>(conn)
       .await
@@ -132,13 +144,13 @@ impl Crud for ModRemoveComment {
   type InsertForm = ModRemoveCommentForm;
   type UpdateForm = ModRemoveCommentForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
     let conn = &mut get_conn(pool).await?;
     mod_remove_comment.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModRemoveCommentForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModRemoveCommentForm) -> Result<Self, Error> {
     use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_remove_comment)
@@ -147,7 +159,11 @@ impl Crud for ModRemoveComment {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &ModRemoveCommentForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &ModRemoveCommentForm,
+  ) -> Result<Self, Error> {
     use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
     let conn = &mut get_conn(pool).await?;
     diesel::update(mod_remove_comment.find(from_id))
@@ -162,13 +178,13 @@ impl Crud for ModRemoveCommunity {
   type InsertForm = ModRemoveCommunityForm;
   type UpdateForm = ModRemoveCommunityForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_remove_community::dsl::mod_remove_community;
     let conn = &mut get_conn(pool).await?;
     mod_remove_community.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
     use crate::schema::mod_remove_community::dsl::mod_remove_community;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_remove_community)
@@ -178,7 +194,7 @@ impl Crud for ModRemoveCommunity {
   }
 
   async fn update(
-    pool: &DbPool,
+    pool: &mut DbPool<'_>,
     from_id: i32,
     form: &ModRemoveCommunityForm,
   ) -> Result<Self, Error> {
@@ -196,7 +212,7 @@ impl Crud for ModBanFromCommunity {
   type InsertForm = ModBanFromCommunityForm;
   type UpdateForm = ModBanFromCommunityForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_ban_from_community::dsl::mod_ban_from_community;
     let conn = &mut get_conn(pool).await?;
     mod_ban_from_community
@@ -205,7 +221,7 @@ impl Crud for ModBanFromCommunity {
       .await
   }
 
-  async fn create(pool: &DbPool, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
     use crate::schema::mod_ban_from_community::dsl::mod_ban_from_community;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_ban_from_community)
@@ -215,7 +231,7 @@ impl Crud for ModBanFromCommunity {
   }
 
   async fn update(
-    pool: &DbPool,
+    pool: &mut DbPool<'_>,
     from_id: i32,
     form: &ModBanFromCommunityForm,
   ) -> Result<Self, Error> {
@@ -233,13 +249,13 @@ impl Crud for ModBan {
   type InsertForm = ModBanForm;
   type UpdateForm = ModBanForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_ban::dsl::mod_ban;
     let conn = &mut get_conn(pool).await?;
     mod_ban.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModBanForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModBanForm) -> Result<Self, Error> {
     use crate::schema::mod_ban::dsl::mod_ban;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_ban)
@@ -248,7 +264,7 @@ impl Crud for ModBan {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
+  async fn update(pool: &mut DbPool<'_>, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
     use crate::schema::mod_ban::dsl::mod_ban;
     let conn = &mut get_conn(pool).await?;
     diesel::update(mod_ban.find(from_id))
@@ -264,13 +280,13 @@ impl Crud for ModHideCommunity {
   type UpdateForm = ModHideCommunityForm;
   type IdType = i32;
 
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_hide_community::dsl::mod_hide_community;
     let conn = &mut get_conn(pool).await?;
     mod_hide_community.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModHideCommunityForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModHideCommunityForm) -> Result<Self, Error> {
     use crate::schema::mod_hide_community::dsl::mod_hide_community;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_hide_community)
@@ -279,7 +295,11 @@ impl Crud for ModHideCommunity {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &ModHideCommunityForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &ModHideCommunityForm,
+  ) -> Result<Self, Error> {
     use crate::schema::mod_hide_community::dsl::mod_hide_community;
     let conn = &mut get_conn(pool).await?;
     diesel::update(mod_hide_community.find(from_id))
@@ -294,13 +314,13 @@ impl Crud for ModAddCommunity {
   type InsertForm = ModAddCommunityForm;
   type UpdateForm = ModAddCommunityForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_add_community::dsl::mod_add_community;
     let conn = &mut get_conn(pool).await?;
     mod_add_community.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModAddCommunityForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModAddCommunityForm) -> Result<Self, Error> {
     use crate::schema::mod_add_community::dsl::mod_add_community;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_add_community)
@@ -309,7 +329,11 @@ impl Crud for ModAddCommunity {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &ModAddCommunityForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &ModAddCommunityForm,
+  ) -> Result<Self, Error> {
     use crate::schema::mod_add_community::dsl::mod_add_community;
     let conn = &mut get_conn(pool).await?;
     diesel::update(mod_add_community.find(from_id))
@@ -324,7 +348,7 @@ impl Crud for ModTransferCommunity {
   type InsertForm = ModTransferCommunityForm;
   type UpdateForm = ModTransferCommunityForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_transfer_community::dsl::mod_transfer_community;
     let conn = &mut get_conn(pool).await?;
     mod_transfer_community
@@ -333,7 +357,7 @@ impl Crud for ModTransferCommunity {
       .await
   }
 
-  async fn create(pool: &DbPool, form: &ModTransferCommunityForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModTransferCommunityForm) -> Result<Self, Error> {
     use crate::schema::mod_transfer_community::dsl::mod_transfer_community;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_transfer_community)
@@ -343,7 +367,7 @@ impl Crud for ModTransferCommunity {
   }
 
   async fn update(
-    pool: &DbPool,
+    pool: &mut DbPool<'_>,
     from_id: i32,
     form: &ModTransferCommunityForm,
   ) -> Result<Self, Error> {
@@ -361,13 +385,13 @@ impl Crud for ModAdd {
   type InsertForm = ModAddForm;
   type UpdateForm = ModAddForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::mod_add::dsl::mod_add;
     let conn = &mut get_conn(pool).await?;
     mod_add.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &ModAddForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &ModAddForm) -> Result<Self, Error> {
     use crate::schema::mod_add::dsl::mod_add;
     let conn = &mut get_conn(pool).await?;
     insert_into(mod_add)
@@ -376,7 +400,7 @@ impl Crud for ModAdd {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
+  async fn update(pool: &mut DbPool<'_>, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
     use crate::schema::mod_add::dsl::mod_add;
     let conn = &mut get_conn(pool).await?;
     diesel::update(mod_add.find(from_id))
@@ -391,13 +415,13 @@ impl Crud for AdminPurgePerson {
   type InsertForm = AdminPurgePersonForm;
   type UpdateForm = AdminPurgePersonForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::admin_purge_person::dsl::admin_purge_person;
     let conn = &mut get_conn(pool).await?;
     admin_purge_person.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &Self::InsertForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
     use crate::schema::admin_purge_person::dsl::admin_purge_person;
     let conn = &mut get_conn(pool).await?;
     insert_into(admin_purge_person)
@@ -406,7 +430,11 @@ impl Crud for AdminPurgePerson {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &Self::InsertForm,
+  ) -> Result<Self, Error> {
     use crate::schema::admin_purge_person::dsl::admin_purge_person;
     let conn = &mut get_conn(pool).await?;
     diesel::update(admin_purge_person.find(from_id))
@@ -421,7 +449,7 @@ impl Crud for AdminPurgeCommunity {
   type InsertForm = AdminPurgeCommunityForm;
   type UpdateForm = AdminPurgeCommunityForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::admin_purge_community::dsl::admin_purge_community;
     let conn = &mut get_conn(pool).await?;
     admin_purge_community
@@ -430,7 +458,7 @@ impl Crud for AdminPurgeCommunity {
       .await
   }
 
-  async fn create(pool: &DbPool, form: &Self::InsertForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
     use crate::schema::admin_purge_community::dsl::admin_purge_community;
     let conn = &mut get_conn(pool).await?;
     insert_into(admin_purge_community)
@@ -439,7 +467,11 @@ impl Crud for AdminPurgeCommunity {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &Self::InsertForm,
+  ) -> Result<Self, Error> {
     use crate::schema::admin_purge_community::dsl::admin_purge_community;
     let conn = &mut get_conn(pool).await?;
     diesel::update(admin_purge_community.find(from_id))
@@ -454,13 +486,13 @@ impl Crud for AdminPurgePost {
   type InsertForm = AdminPurgePostForm;
   type UpdateForm = AdminPurgePostForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::admin_purge_post::dsl::admin_purge_post;
     let conn = &mut get_conn(pool).await?;
     admin_purge_post.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &Self::InsertForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
     use crate::schema::admin_purge_post::dsl::admin_purge_post;
     let conn = &mut get_conn(pool).await?;
     insert_into(admin_purge_post)
@@ -469,7 +501,11 @@ impl Crud for AdminPurgePost {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &Self::InsertForm,
+  ) -> Result<Self, Error> {
     use crate::schema::admin_purge_post::dsl::admin_purge_post;
     let conn = &mut get_conn(pool).await?;
     diesel::update(admin_purge_post.find(from_id))
@@ -484,13 +520,13 @@ impl Crud for AdminPurgeComment {
   type InsertForm = AdminPurgeCommentForm;
   type UpdateForm = AdminPurgeCommentForm;
   type IdType = i32;
-  async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+  async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
     use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
     let conn = &mut get_conn(pool).await?;
     admin_purge_comment.find(from_id).first::<Self>(conn).await
   }
 
-  async fn create(pool: &DbPool, form: &Self::InsertForm) -> Result<Self, Error> {
+  async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
     use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
     let conn = &mut get_conn(pool).await?;
     insert_into(admin_purge_comment)
@@ -499,7 +535,11 @@ impl Crud for AdminPurgeComment {
       .await
   }
 
-  async fn update(pool: &DbPool, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
+  async fn update(
+    pool: &mut DbPool<'_>,
+    from_id: i32,
+    form: &Self::InsertForm,
+  ) -> Result<Self, Error> {
     use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
     let conn = &mut get_conn(pool).await?;
     diesel::update(admin_purge_comment.find(from_id))
@@ -525,6 +565,8 @@ mod tests {
         ModBanForm,
         ModBanFromCommunity,
         ModBanFromCommunityForm,
+        ModFeaturePost,
+        ModFeaturePostForm,
         ModLockPost,
         ModLockPostForm,
         ModRemoveComment,
@@ -533,8 +575,6 @@ mod tests {
         ModRemoveCommunityForm,
         ModRemovePost,
         ModRemovePostForm,
-        ModStickyPost,
-        ModStickyPostForm,
       },
       person::{Person, PersonInsertForm},
       post::{Post, PostInsertForm},
@@ -548,8 +588,11 @@ mod tests {
   #[serial]
   async fn test_crud() {
     let pool = &build_db_pool_for_tests().await;
+    let pool = &mut pool.into();
 
-    let inserted_instance = Instance::create(pool, "my_domain.tld").await.unwrap();
+    let inserted_instance = Instance::read_or_create(pool, "my_domain.tld".to_string())
+      .await
+      .unwrap();
 
     let new_mod = PersonInsertForm::builder()
       .name("the mod".into())
@@ -612,7 +655,7 @@ mod tests {
       post_id: inserted_post.id,
       mod_person_id: inserted_mod.id,
       reason: None,
-      removed: Some(true),
+      removed: true,
       when_: inserted_mod_remove_post.when_,
     };
 
@@ -633,29 +676,31 @@ mod tests {
       id: inserted_mod_lock_post.id,
       post_id: inserted_post.id,
       mod_person_id: inserted_mod.id,
-      locked: Some(true),
+      locked: true,
       when_: inserted_mod_lock_post.when_,
     };
 
-    // sticky post
+    // feature post
 
-    let mod_sticky_post_form = ModStickyPostForm {
+    let mod_feature_post_form = ModFeaturePostForm {
       mod_person_id: inserted_mod.id,
       post_id: inserted_post.id,
-      stickied: None,
+      featured: false,
+      is_featured_community: true,
     };
-    let inserted_mod_sticky_post = ModStickyPost::create(pool, &mod_sticky_post_form)
+    let inserted_mod_feature_post = ModFeaturePost::create(pool, &mod_feature_post_form)
       .await
       .unwrap();
-    let read_mod_sticky_post = ModStickyPost::read(pool, inserted_mod_sticky_post.id)
+    let read_mod_feature_post = ModFeaturePost::read(pool, inserted_mod_feature_post.id)
       .await
       .unwrap();
-    let expected_mod_sticky_post = ModStickyPost {
-      id: inserted_mod_sticky_post.id,
+    let expected_mod_feature_post = ModFeaturePost {
+      id: inserted_mod_feature_post.id,
       post_id: inserted_post.id,
       mod_person_id: inserted_mod.id,
-      stickied: Some(true),
-      when_: inserted_mod_sticky_post.when_,
+      featured: false,
+      is_featured_community: true,
+      when_: inserted_mod_feature_post.when_,
     };
 
     // comment
@@ -677,7 +722,7 @@ mod tests {
       comment_id: inserted_comment.id,
       mod_person_id: inserted_mod.id,
       reason: None,
-      removed: Some(true),
+      removed: true,
       when_: inserted_mod_remove_comment.when_,
     };
 
@@ -703,7 +748,7 @@ mod tests {
       community_id: inserted_community.id,
       mod_person_id: inserted_mod.id,
       reason: None,
-      removed: Some(true),
+      removed: true,
       expires: None,
       when_: inserted_mod_remove_community.when_,
     };
@@ -732,7 +777,7 @@ mod tests {
       mod_person_id: inserted_mod.id,
       other_person_id: inserted_person.id,
       reason: None,
-      banned: Some(true),
+      banned: true,
       expires: None,
       when_: inserted_mod_ban_from_community.when_,
     };
@@ -753,7 +798,7 @@ mod tests {
       mod_person_id: inserted_mod.id,
       other_person_id: inserted_person.id,
       reason: None,
-      banned: Some(true),
+      banned: true,
       expires: None,
       when_: inserted_mod_ban.when_,
     };
@@ -777,7 +822,7 @@ mod tests {
       community_id: inserted_community.id,
       mod_person_id: inserted_mod.id,
       other_person_id: inserted_person.id,
-      removed: Some(false),
+      removed: false,
       when_: inserted_mod_add_community.when_,
     };
 
@@ -794,7 +839,7 @@ mod tests {
       id: inserted_mod_add.id,
       mod_person_id: inserted_mod.id,
       other_person_id: inserted_person.id,
-      removed: Some(false),
+      removed: false,
       when_: inserted_mod_add.when_,
     };
 
@@ -809,7 +854,7 @@ mod tests {
 
     assert_eq!(expected_mod_remove_post, read_mod_remove_post);
     assert_eq!(expected_mod_lock_post, read_mod_lock_post);
-    assert_eq!(expected_mod_sticky_post, read_mod_sticky_post);
+    assert_eq!(expected_mod_feature_post, read_mod_feature_post);
     assert_eq!(expected_mod_remove_comment, read_mod_remove_comment);
     assert_eq!(expected_mod_remove_community, read_mod_remove_community);
     assert_eq!(expected_mod_ban_from_community, read_mod_ban_from_community);