mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
Merge pull request #1422 from LemmyNet/display_name_limit
Display name limit
This commit is contained in:
commit
08900b5b94
3 changed files with 4 additions and 4 deletions
|
@ -672,7 +672,7 @@ impl Perform for CreateCommentReport {
|
||||||
if reason.is_empty() {
|
if reason.is_empty() {
|
||||||
return Err(APIError::err("report_reason_required").into());
|
return Err(APIError::err("report_reason_required").into());
|
||||||
}
|
}
|
||||||
if reason.len() > 1000 {
|
if reason.chars().count() > 1000 {
|
||||||
return Err(APIError::err("report_too_long").into());
|
return Err(APIError::err("report_too_long").into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -749,7 +749,7 @@ impl Perform for CreatePostReport {
|
||||||
if reason.is_empty() {
|
if reason.is_empty() {
|
||||||
return Err(APIError::err("report_reason_required").into());
|
return Err(APIError::err("report_reason_required").into());
|
||||||
}
|
}
|
||||||
if reason.len() > 1000 {
|
if reason.chars().count() > 1000 {
|
||||||
return Err(APIError::err("report_too_long").into());
|
return Err(APIError::err("report_too_long").into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,8 @@ pub fn is_valid_username(name: &str) -> bool {
|
||||||
// Can't do a regex here, reverse lookarounds not supported
|
// Can't do a regex here, reverse lookarounds not supported
|
||||||
pub fn is_valid_preferred_username(preferred_username: &str) -> bool {
|
pub fn is_valid_preferred_username(preferred_username: &str) -> bool {
|
||||||
!preferred_username.starts_with('@')
|
!preferred_username.starts_with('@')
|
||||||
&& preferred_username.len() >= 3
|
&& preferred_username.chars().count() >= 3
|
||||||
&& preferred_username.len() <= 20
|
&& preferred_username.chars().count() <= 20
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_valid_community_name(name: &str) -> bool {
|
pub fn is_valid_community_name(name: &str) -> bool {
|
||||||
|
|
Loading…
Reference in a new issue