From b1a0a728d23c7c5e3d2455ab7ca23f1325188eb3 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 26 Apr 2026 08:43:43 +0300 Subject: [PATCH] fix: replace 6-word limit with 150-character limit for project names (#1077) Replaces the word-based validation with character-based validation as originally requested in #971. The 6-word limit was causing issues with small words and separators being counted equally, and didn't match the original requirement for a character limit. Changes: - Backend: Replace wordCount validator with len validator (1-150 chars) - Frontend: Replace word count validation with character length check - UI already has line-clamp-3 for display truncation Fixes #998 --- backend/models/project.js | 14 +++----------- frontend/components/Project/ProjectModal.tsx | 10 +++------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/backend/models/project.js b/backend/models/project.js index 2abdcc5..7f8bf98 100644 --- a/backend/models/project.js +++ b/backend/models/project.js @@ -23,17 +23,9 @@ module.exports = (sequelize) => { notEmpty: { msg: 'Project name is required', }, - wordCount(value) { - const MAX_WORDS = 6; - const wordCount = value - .trim() - .split(/\s+/) - .filter((word) => word.length > 0).length; - if (wordCount > MAX_WORDS) { - throw new Error( - `Project name must be ${MAX_WORDS} words or less` - ); - } + len: { + args: [1, 150], + msg: 'Project name must be between 1 and 150 characters', }, }, }, diff --git a/frontend/components/Project/ProjectModal.tsx b/frontend/components/Project/ProjectModal.tsx index df63a98..69e9bc0 100644 --- a/frontend/components/Project/ProjectModal.tsx +++ b/frontend/components/Project/ProjectModal.tsx @@ -268,16 +268,12 @@ const ProjectModal: React.FC = ({ return; } - const MAX_WORDS = 6; - const wordCount = formData.name - .trim() - .split(/\s+/) - .filter((word) => word.length > 0).length; - if (wordCount > MAX_WORDS) { + const MAX_LENGTH = 150; + if (formData.name.trim().length > MAX_LENGTH) { setError( t( 'errors.projectNameTooLong', - `Project name must be ${MAX_WORDS} words or less` + `Project name must be ${MAX_LENGTH} characters or less` ) ); return;