]> Untitled Git - lemmy.git/commitdiff
Edit community name validation, translations #823
authorErnest <ernestwisniewski2@gmail.com>
Mon, 22 Jun 2020 07:23:54 +0000 (09:23 +0200)
committerErnest <ernestwisniewski2@gmail.com>
Mon, 22 Jun 2020 07:23:54 +0000 (09:23 +0200)
server/src/api/community.rs
ui/translations/en.json

index 2a517bb8c79205c454105f901539ad0d08b7bd53..618122b9868a1aab8c1a32ef16e455f974b732ae 100644 (file)
@@ -311,6 +311,10 @@ impl Perform for Oper<EditCommunity> {
       Err(_e) => return Err(APIError::err("not_logged_in").into()),
     };
 
+    if !is_valid_community_name(&data.name) {
+      return Err(APIError::err("invalid_community_name").into());
+    }
+
     let user_id = claims.id;
 
     let conn = pool.get()?;
index 874172237f9fd19d1978fa01c5002a7ff5e6ee4c..a07da6216f3aafd2b31efe9ebe37e90bc8ed35b7 100644 (file)
@@ -27,6 +27,7 @@
     "number_of_communities": "{{count}} Community",
     "number_of_communities_plural": "{{count}} Communities",
     "community_reqs": "lowercase, underscores, and no spaces.",
+    "invalid_community_name": "Invalid name.",
     "create_private_message": "Create Private Message",
     "send_secure_message": "Send Secure Message",
     "send_message": "Send Message",