]> Untitled Git - lemmy.git/blobdiff - src/code_migrations.rs
Implement restricted community (only mods can post) (fixes #187) (#2235)
[lemmy.git] / src / code_migrations.rs
index 161dd3b607f83e89108311fa63017e41a61eec85..69e419161648456d9961e54c68d2ac7a7dc9b80d 100644 (file)
@@ -53,7 +53,7 @@ fn user_updates_2020_04_02(
 
   // Update the actor_id, private_key, and public_key, last_refreshed_at
   let incorrect_persons = person
-    .filter(actor_id.like("http://changeme_%"))
+    .filter(actor_id.like("http://changeme%"))
     .filter(local.eq(true))
     .load::<Person>(conn)?;
 
@@ -91,7 +91,7 @@ fn community_updates_2020_04_02(
 
   // Update the actor_id, private_key, and public_key, last_refreshed_at
   let incorrect_communities = community
-    .filter(actor_id.like("http://changeme_%"))
+    .filter(actor_id.like("http://changeme%"))
     .filter(local.eq(true))
     .load::<Community>(conn)?;
 
@@ -107,21 +107,15 @@ fn community_updates_2020_04_02(
       name: ccommunity.name.to_owned(),
       title: ccommunity.title.to_owned(),
       description: ccommunity.description.to_owned(),
-      removed: None,
-      deleted: None,
-      nsfw: None,
-      updated: None,
+      hidden: Some(false),
       actor_id: Some(community_actor_id.to_owned()),
       local: Some(ccommunity.local),
       private_key: Some(Some(keypair.private_key)),
       public_key: keypair.public_key,
       last_refreshed_at: Some(naive_now()),
-      published: None,
       icon: Some(ccommunity.icon.to_owned()),
       banner: Some(ccommunity.banner.to_owned()),
-      followers_url: None,
-      inbox_url: None,
-      shared_inbox_url: None,
+      ..Default::default()
     };
 
     Community::update(conn, ccommunity.id, &form)?;
@@ -142,7 +136,7 @@ fn post_updates_2020_04_03(
 
   // Update the ap_id
   let incorrect_posts = post
-    .filter(ap_id.like("http://changeme_%"))
+    .filter(ap_id.like("http://changeme%"))
     .filter(local.eq(true))
     .load::<Post>(conn)?;
 
@@ -170,7 +164,7 @@ fn comment_updates_2020_04_03(
 
   // Update the ap_id
   let incorrect_comments = comment
-    .filter(ap_id.like("http://changeme_%"))
+    .filter(ap_id.like("http://changeme%"))
     .filter(local.eq(true))
     .load::<Comment>(conn)?;
 
@@ -198,7 +192,7 @@ fn private_message_updates_2020_05_05(
 
   // Update the ap_id
   let incorrect_pms = private_message
-    .filter(ap_id.like("http://changeme_%"))
+    .filter(ap_id.like("http://changeme%"))
     .filter(local.eq(true))
     .load::<PrivateMessage>(conn)?;
 
@@ -251,7 +245,7 @@ fn apub_columns_2021_02_02(conn: &PgConnection) -> Result<(), LemmyError> {
   {
     use lemmy_db_schema::schema::person::dsl::*;
     let persons = person
-      .filter(inbox_url.like("http://changeme_%"))
+      .filter(inbox_url.like("http://changeme%"))
       .load::<Person>(conn)?;
 
     for p in &persons {
@@ -269,7 +263,7 @@ fn apub_columns_2021_02_02(conn: &PgConnection) -> Result<(), LemmyError> {
   {
     use lemmy_db_schema::schema::community::dsl::*;
     let communities = community
-      .filter(inbox_url.like("http://changeme_%"))
+      .filter(inbox_url.like("http://changeme%"))
       .load::<Community>(conn)?;
 
     for c in &communities {