]> Untitled Git - lemmy.git/commitdiff
Remove GetCommunityResponse.default_post_language (#2867)
authorNutomic <me@nutomic.com>
Sun, 21 May 2023 15:55:32 +0000 (17:55 +0200)
committerGitHub <noreply@github.com>
Sun, 21 May 2023 15:55:32 +0000 (11:55 -0400)
This field is unnecessary because we already set a default language
with the same logic if none is passed in CreatePost. So if the user
doesnt set a post language, it should simply be passed as None. This
also has the advantage that it works with clients that dont support
language tags.

Technically not a breaking change because its optional, but better
be safe.

crates/api/src/community/transfer.rs
crates/api_common/src/community.rs
crates/apub/src/api/read_community.rs

index a34dfb40d56f3064cc8e2ea96a4243fcfdf4402d..d96ba8488dda0c17789deedf5498eb1ed3e30f19 100644 (file)
@@ -98,7 +98,6 @@ impl Perform for TransferCommunity {
       moderators,
       online: 0,
       discussion_languages: vec![],
-      default_post_language: None,
     })
   }
 }
index ab804a7ebf8acab45c63ffd8ca6d0b81b21a577b..becf29ab479e68b6ef859bc63ebcc100dc396ae5 100644 (file)
@@ -34,9 +34,6 @@ pub struct GetCommunityResponse {
   pub moderators: Vec<CommunityModeratorView>,
   pub online: usize,
   pub discussion_languages: Vec<LanguageId>,
-  /// Default language used for new posts if none is specified, generated based on community and
-  /// user languages.
-  pub default_post_language: Option<LanguageId>,
 }
 
 #[skip_serializing_none]
index 3dc56a940f46e36636d63734c438be3ad412a682..e01c7bdaf06cf59bfde1baa7c915544c43767490 100644 (file)
@@ -10,14 +10,11 @@ use lemmy_api_common::{
   utils::{check_private_instance, get_local_user_view_from_jwt_opt, is_mod_or_admin_opt},
   websocket::handlers::online_users::GetCommunityUsersOnline,
 };
-use lemmy_db_schema::{
-  impls::actor_language::default_post_language,
-  source::{
-    actor_language::CommunityLanguage,
-    community::Community,
-    local_site::LocalSite,
-    site::Site,
-  },
+use lemmy_db_schema::source::{
+  actor_language::CommunityLanguage,
+  community::Community,
+  local_site::LocalSite,
+  site::Site,
 };
 use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
 use lemmy_utils::{error::LemmyError, ConnectionId};
@@ -93,11 +90,6 @@ impl PerformApub for GetCommunity {
 
     let community_id = community_view.community.id;
     let discussion_languages = CommunityLanguage::read(context.pool(), community_id).await?;
-    let default_post_language = if let Some(user) = local_user_view {
-      default_post_language(context.pool(), community_id, user.local_user.id).await?
-    } else {
-      None
-    };
 
     let res = GetCommunityResponse {
       community_view,
@@ -105,7 +97,6 @@ impl PerformApub for GetCommunity {
       moderators,
       online,
       discussion_languages,
-      default_post_language,
     };
 
     // Return the jwt