From e82f72d3c8c435ff302f5b54d974dd66b609fc50 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 27 Sep 2024 15:23:19 +0200 Subject: [PATCH] Avoid breaking changes, keep response fields as deprecated (#5058) --- crates/api/src/site/leave_admin.rs | 2 ++ crates/api_common/src/site.rs | 6 ++++++ crates/api_crud/src/site/create.rs | 5 ++++- crates/api_crud/src/site/read.rs | 2 ++ crates/api_crud/src/site/update.rs | 5 ++++- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/api/src/site/leave_admin.rs b/crates/api/src/site/leave_admin.rs index 5e1e69d49..f5ddec35b 100644 --- a/crates/api/src/site/leave_admin.rs +++ b/crates/api/src/site/leave_admin.rs @@ -76,5 +76,7 @@ pub async fn leave_admin( admin_oauth_providers: None, blocked_urls, tagline, + taglines: vec![], + custom_emojis: vec![], })) } diff --git a/crates/api_common/src/site.rs b/crates/api_common/src/site.rs index 1ffabb75a..d82303327 100644 --- a/crates/api_common/src/site.rs +++ b/crates/api_common/src/site.rs @@ -306,6 +306,8 @@ pub struct EditSite { /// The response for a site. pub struct SiteResponse { pub site_view: SiteView, + /// deprecated, use field `tagline` or /api/v3/tagline/list + pub taglines: Vec<()>, } #[skip_serializing_none] @@ -320,6 +322,10 @@ pub struct GetSiteResponse { pub my_user: Option, pub all_languages: Vec, pub discussion_languages: Vec, + /// deprecated, use field `tagline` or /api/v3/tagline/list + pub taglines: Vec<()>, + /// deprecated, use /api/v3/custom_emoji/list + pub custom_emojis: Vec<()>, /// If the site has any taglines, a random one is included here for displaying pub tagline: Option, /// A list of external auth methods your site supports. diff --git a/crates/api_crud/src/site/create.rs b/crates/api_crud/src/site/create.rs index 28faa0aac..9b0439da8 100644 --- a/crates/api_crud/src/site/create.rs +++ b/crates/api_crud/src/site/create.rs @@ -139,7 +139,10 @@ pub async fn create_site( local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit); context.rate_limit_cell().set_config(rate_limit_config); - Ok(Json(SiteResponse { site_view })) + Ok(Json(SiteResponse { + site_view, + taglines: vec![], + })) } fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) -> LemmyResult<()> { diff --git a/crates/api_crud/src/site/read.rs b/crates/api_crud/src/site/read.rs index 0901b9186..20c10c415 100644 --- a/crates/api_crud/src/site/read.rs +++ b/crates/api_crud/src/site/read.rs @@ -59,6 +59,8 @@ pub async fn get_site( tagline, oauth_providers: Some(oauth_providers), admin_oauth_providers: Some(admin_oauth_providers), + taglines: vec![], + custom_emojis: vec![], }) }) .await diff --git a/crates/api_crud/src/site/update.rs b/crates/api_crud/src/site/update.rs index 8b1934572..495a5cc98 100644 --- a/crates/api_crud/src/site/update.rs +++ b/crates/api_crud/src/site/update.rs @@ -193,7 +193,10 @@ pub async fn update_site( local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit); context.rate_limit_cell().set_config(rate_limit_config); - Ok(Json(SiteResponse { site_view })) + Ok(Json(SiteResponse { + site_view, + taglines: vec![], + })) } fn validate_update_payload(local_site: &LocalSite, edit_site: &EditSite) -> LemmyResult<()> {