mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-15 08:54:01 +00:00
Remove GetCommunityResponse.default_post_language (#2867)
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.
This commit is contained in:
parent
a9d708f494
commit
82d93da26b
3 changed files with 5 additions and 18 deletions
|
@ -98,7 +98,6 @@ impl Perform for TransferCommunity {
|
||||||
moderators,
|
moderators,
|
||||||
online: 0,
|
online: 0,
|
||||||
discussion_languages: vec![],
|
discussion_languages: vec![],
|
||||||
default_post_language: None,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,6 @@ pub struct GetCommunityResponse {
|
||||||
pub moderators: Vec<CommunityModeratorView>,
|
pub moderators: Vec<CommunityModeratorView>,
|
||||||
pub online: usize,
|
pub online: usize,
|
||||||
pub discussion_languages: Vec<LanguageId>,
|
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]
|
#[skip_serializing_none]
|
||||||
|
|
|
@ -10,14 +10,11 @@ use lemmy_api_common::{
|
||||||
utils::{check_private_instance, get_local_user_view_from_jwt_opt, is_mod_or_admin_opt},
|
utils::{check_private_instance, get_local_user_view_from_jwt_opt, is_mod_or_admin_opt},
|
||||||
websocket::handlers::online_users::GetCommunityUsersOnline,
|
websocket::handlers::online_users::GetCommunityUsersOnline,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::source::{
|
||||||
impls::actor_language::default_post_language,
|
|
||||||
source::{
|
|
||||||
actor_language::CommunityLanguage,
|
actor_language::CommunityLanguage,
|
||||||
community::Community,
|
community::Community,
|
||||||
local_site::LocalSite,
|
local_site::LocalSite,
|
||||||
site::Site,
|
site::Site,
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
|
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
|
||||||
use lemmy_utils::{error::LemmyError, ConnectionId};
|
use lemmy_utils::{error::LemmyError, ConnectionId};
|
||||||
|
@ -93,11 +90,6 @@ impl PerformApub for GetCommunity {
|
||||||
|
|
||||||
let community_id = community_view.community.id;
|
let community_id = community_view.community.id;
|
||||||
let discussion_languages = CommunityLanguage::read(context.pool(), community_id).await?;
|
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 {
|
let res = GetCommunityResponse {
|
||||||
community_view,
|
community_view,
|
||||||
|
@ -105,7 +97,6 @@ impl PerformApub for GetCommunity {
|
||||||
moderators,
|
moderators,
|
||||||
online,
|
online,
|
||||||
discussion_languages,
|
discussion_languages,
|
||||||
default_post_language,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return the jwt
|
// Return the jwt
|
||||||
|
|
Loading…
Reference in a new issue