]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/site/update.rs
Add support for Taglines (#2548)
[lemmy.git] / crates / api_crud / src / site / update.rs
index a4eba29bd47bc7ded06433ced95b90bef52cdf0c..40a356b6dde1e4663a544b2c59313a12ccbbe246 100644 (file)
@@ -19,6 +19,7 @@ use lemmy_db_schema::{
     local_site_rate_limit::{LocalSiteRateLimit, LocalSiteRateLimitUpdateForm},
     local_user::LocalUser,
     site::{Site, SiteUpdateForm},
+    tagline::Tagline,
   },
   traits::Crud,
   utils::{diesel_option_overwrite, diesel_option_overwrite_to_url, naive_now},
@@ -79,7 +80,7 @@ impl PerformCrud for EditSite {
       SiteLanguage::update(context.pool(), discussion_languages.clone(), &site).await?;
     }
 
-    let name = data.name.to_owned();
+    let name = data.name.clone();
     let site_form = SiteUpdateForm::builder()
       .name(name)
       .sidebar(diesel_option_overwrite(&data.sidebar))
@@ -118,7 +119,7 @@ impl PerformCrud for EditSite {
       .federation_http_fetch_retry_limit(data.federation_http_fetch_retry_limit)
       .federation_worker_count(data.federation_worker_count)
       .captcha_enabled(data.captcha_enabled)
-      .captcha_difficulty(data.captcha_difficulty.to_owned())
+      .captcha_difficulty(data.captcha_difficulty.clone())
       .build();
 
     let update_local_site = LocalSite::update(context.pool(), &local_site_form)
@@ -145,9 +146,9 @@ impl PerformCrud for EditSite {
       .ok();
 
     // Replace the blocked and allowed instances
-    let allowed = data.allowed_instances.to_owned();
+    let allowed = data.allowed_instances.clone();
     FederationAllowList::replace(context.pool(), allowed).await?;
-    let blocked = data.blocked_instances.to_owned();
+    let blocked = data.blocked_instances.clone();
     FederationBlockList::replace(context.pool(), blocked).await?;
 
     // TODO can't think of a better way to do this.
@@ -175,6 +176,9 @@ impl PerformCrud for EditSite {
         .map_err(|e| LemmyError::from_error_message(e, "couldnt_set_all_email_verified"))?;
     }
 
+    let taglines = data.taglines.to_owned();
+    Tagline::replace(context.pool(), local_site.id, taglines).await?;
+
     let site_view = SiteView::read_local(context.pool()).await?;
 
     let rate_limit_config =