mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-29 07:41:20 +00:00
rename
This commit is contained in:
parent
0337816803
commit
163bc3ffc4
5 changed files with 11 additions and 11 deletions
|
@ -16,7 +16,7 @@ use lemmy_api_common::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
impls::actor_language::default_post_language,
|
impls::actor_language::validate_post_language,
|
||||||
source::{
|
source::{
|
||||||
comment::{Comment, CommentInsertForm, CommentLike, CommentLikeForm},
|
comment::{Comment, CommentInsertForm, CommentLike, CommentLikeForm},
|
||||||
comment_reply::{CommentReply, CommentReplyUpdateForm},
|
comment_reply::{CommentReply, CommentReplyUpdateForm},
|
||||||
|
@ -87,7 +87,7 @@ pub async fn create_comment(
|
||||||
check_comment_depth(parent)?;
|
check_comment_depth(parent)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let language_id = default_post_language(
|
let language_id = validate_post_language(
|
||||||
&mut context.pool(),
|
&mut context.pool(),
|
||||||
data.language_id,
|
data.language_id,
|
||||||
community_id,
|
community_id,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use lemmy_api_common::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
impls::actor_language::default_post_language,
|
impls::actor_language::validate_post_language,
|
||||||
source::{
|
source::{
|
||||||
comment::{Comment, CommentUpdateForm},
|
comment::{Comment, CommentUpdateForm},
|
||||||
local_site::LocalSite,
|
local_site::LocalSite,
|
||||||
|
@ -55,7 +55,7 @@ pub async fn update_comment(
|
||||||
Err(LemmyErrorType::NoCommentEditAllowed)?
|
Err(LemmyErrorType::NoCommentEditAllowed)?
|
||||||
}
|
}
|
||||||
|
|
||||||
let language_id = default_post_language(
|
let language_id = validate_post_language(
|
||||||
&mut context.pool(),
|
&mut context.pool(),
|
||||||
data.language_id,
|
data.language_id,
|
||||||
orig_comment.community.id,
|
orig_comment.community.id,
|
||||||
|
|
|
@ -17,7 +17,7 @@ use lemmy_api_common::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
impls::actor_language::default_post_language,
|
impls::actor_language::validate_post_language,
|
||||||
source::{
|
source::{
|
||||||
community::Community,
|
community::Community,
|
||||||
local_site::LocalSite,
|
local_site::LocalSite,
|
||||||
|
@ -103,7 +103,7 @@ pub async fn create_post(
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let language_id = default_post_language(
|
let language_id = validate_post_language(
|
||||||
&mut context.pool(),
|
&mut context.pool(),
|
||||||
data.language_id,
|
data.language_id,
|
||||||
community_id,
|
community_id,
|
||||||
|
|
|
@ -15,7 +15,7 @@ use lemmy_api_common::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
impls::actor_language::default_post_language,
|
impls::actor_language::validate_post_language,
|
||||||
source::{
|
source::{
|
||||||
community::Community,
|
community::Community,
|
||||||
local_site::LocalSite,
|
local_site::LocalSite,
|
||||||
|
@ -101,7 +101,7 @@ pub async fn update_post(
|
||||||
Err(LemmyErrorType::NoPostEditAllowed)?
|
Err(LemmyErrorType::NoPostEditAllowed)?
|
||||||
}
|
}
|
||||||
|
|
||||||
let language_id = default_post_language(
|
let language_id = validate_post_language(
|
||||||
&mut context.pool(),
|
&mut context.pool(),
|
||||||
data.language_id,
|
data.language_id,
|
||||||
orig_post.community_id,
|
orig_post.community_id,
|
||||||
|
|
|
@ -319,7 +319,7 @@ impl CommunityLanguage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn default_post_language(
|
pub async fn validate_post_language(
|
||||||
pool: &mut DbPool<'_>,
|
pool: &mut DbPool<'_>,
|
||||||
language_id: Option<LanguageId>,
|
language_id: Option<LanguageId>,
|
||||||
community_id: CommunityId,
|
community_id: CommunityId,
|
||||||
|
@ -622,7 +622,7 @@ mod tests {
|
||||||
LocalUserLanguage::update(pool, test_langs2, local_user.id).await?;
|
LocalUserLanguage::update(pool, test_langs2, local_user.id).await?;
|
||||||
|
|
||||||
// no overlap in user/community languages, so defaults to undetermined
|
// no overlap in user/community languages, so defaults to undetermined
|
||||||
let def1 = default_post_language(pool, None, community.id, local_user.id).await;
|
let def1 = validate_post_language(pool, None, community.id, local_user.id).await;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(LemmyErrorType::LanguageNotAllowed),
|
Some(LemmyErrorType::LanguageNotAllowed),
|
||||||
def1.err().map(|e| e.error_type)
|
def1.err().map(|e| e.error_type)
|
||||||
|
@ -638,7 +638,7 @@ mod tests {
|
||||||
LocalUserLanguage::update(pool, test_langs3, local_user.id).await?;
|
LocalUserLanguage::update(pool, test_langs3, local_user.id).await?;
|
||||||
|
|
||||||
// this time, both have ru as common lang
|
// this time, both have ru as common lang
|
||||||
let def2 = default_post_language(pool, None, community.id, local_user.id).await?;
|
let def2 = validate_post_language(pool, None, community.id, local_user.id).await?;
|
||||||
assert_eq!(ru, def2);
|
assert_eq!(ru, def2);
|
||||||
|
|
||||||
Person::delete(pool, person.id).await?;
|
Person::delete(pool, person.id).await?;
|
||||||
|
|
Loading…
Reference in a new issue