Skip to content

Commit 135390e

Browse files
committed
fix(tasks): apply consistent 200-char title limit across create/edit flows
1 parent ad5d1b0 commit 135390e

5 files changed

Lines changed: 36 additions & 7 deletions

File tree

src/app/features/projects/components/project-kanban/project-kanban.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ <h3>Edit Task</h3>
316316
<div class="task-dialog-form">
317317
<div class="task-control">
318318
<label for="editTaskTitle">Title</label>
319-
<input id="editTaskTitle" pInputText [(ngModel)]="taskForm.title" placeholder="Task title" />
319+
<input id="editTaskTitle" pInputText [(ngModel)]="taskForm.title" [maxlength]="200" placeholder="Task title" />
320320
</div>
321321

322322
<div class="task-control">
@@ -366,7 +366,7 @@ <h3>Edit Task</h3>
366366

367367
<div class="task-dialog-actions">
368368
<button pButton type="button" label="Cancel" class="p-button-text" (click)="closeTaskDialogs()"></button>
369-
<button pButton type="button" label="Save changes" icon="pi pi-check" [loading]="isSavingTask" [disabled]="!taskForm.title.trim()" (click)="saveEditTask()"></button>
369+
<button pButton type="button" label="Save changes" icon="pi pi-check" [loading]="isSavingTask" [disabled]="!taskForm.title.trim() || taskForm.title.trim().length > 200" (click)="saveEditTask()"></button>
370370
</div>
371371
</div>
372372
</div>
@@ -396,7 +396,7 @@ <h3>Create Task</h3>
396396
<div class="task-dialog-form">
397397
<div class="task-control">
398398
<label for="createTaskTitle">Title</label>
399-
<input id="createTaskTitle" pInputText [(ngModel)]="taskForm.title" placeholder="Task title" />
399+
<input id="createTaskTitle" pInputText [(ngModel)]="taskForm.title" [maxlength]="200" placeholder="Task title" />
400400
</div>
401401

402402
<div class="task-control">
@@ -432,7 +432,7 @@ <h3>Create Task</h3>
432432
label="Create task"
433433
icon="pi pi-plus"
434434
[loading]="isSavingTask"
435-
[disabled]="!taskForm.title.trim() || !selectedProjectId"
435+
[disabled]="!taskForm.title.trim() || taskForm.title.trim().length > 200 || !selectedProjectId"
436436
(click)="saveCreateTask()">
437437
</button>
438438
</div>

src/app/features/projects/components/project-kanban/project-kanban.component.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export class ProjectKanbanComponent implements OnInit, OnDestroy {
6363
private static readonly ASSIGNEE_PAGE_SIZE = 500;
6464
private static readonly ASSIGNEE_FILTER_ALL = '__all';
6565
private static readonly ASSIGNEE_FILTER_UNASSIGNED = '__unassigned';
66+
private static readonly TITLE_MAX_LENGTH = 200;
6667
private readonly projectsApiClient = inject(ProjectsApiClient);
6768
private readonly adminUsersApiClient = inject(AdminUsersApiClient);
6869
private readonly taskItemsApiClient = inject(TaskItemsApiClient);
@@ -325,6 +326,15 @@ export class ProjectKanbanComponent implements OnInit, OnDestroy {
325326
return;
326327
}
327328

329+
if (title.length > ProjectKanbanComponent.TITLE_MAX_LENGTH) {
330+
this.messageService.add({
331+
severity: 'warn',
332+
summary: 'Title too long',
333+
detail: `Task title must be ${ProjectKanbanComponent.TITLE_MAX_LENGTH} characters or fewer.`
334+
});
335+
return;
336+
}
337+
328338
const request: CreateTaskItemRequest = {
329339
projectId: this.selectedProjectId,
330340
title,
@@ -384,6 +394,15 @@ export class ProjectKanbanComponent implements OnInit, OnDestroy {
384394
return;
385395
}
386396

397+
if (title.length > ProjectKanbanComponent.TITLE_MAX_LENGTH) {
398+
this.messageService.add({
399+
severity: 'warn',
400+
summary: 'Title too long',
401+
detail: `Task title must be ${ProjectKanbanComponent.TITLE_MAX_LENGTH} characters or fewer.`
402+
});
403+
return;
404+
}
405+
387406
const task = this.findTaskById(taskId);
388407
if (!task) {
389408
return;

src/app/features/task-item/components/task-item-create/task-item-create.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class TaskItemCreateComponent implements OnInit, OnDestroy {
5151
{ label: 'Planning' },
5252
{ label: 'Ready' }
5353
];
54-
readonly maxTitleLength = 160;
54+
readonly maxTitleLength = 200;
5555
readonly maxDescriptionLength = 2000;
5656

5757
ngOnInit(): void {

src/app/features/task-item/components/user-task-items/user-task-items.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ <h3>Edit Task</h3>
197197
<div class="task-dialog-form">
198198
<div class="task-control">
199199
<label for="taskEditTitle">Title</label>
200-
<input id="taskEditTitle" pInputText [(ngModel)]="taskForm.title" placeholder="Task title" />
200+
<input id="taskEditTitle" pInputText [(ngModel)]="taskForm.title" [maxlength]="200" placeholder="Task title" />
201201
</div>
202202

203203
<div class="task-control">
@@ -222,7 +222,7 @@ <h3>Edit Task</h3>
222222

223223
<div class="task-dialog-actions">
224224
<button pButton type="button" label="Cancel" class="p-button-text" (click)="closeEditDialog()"></button>
225-
<button pButton type="button" label="Save changes" icon="pi pi-check" [loading]="isSavingTask" [disabled]="!taskForm.title.trim()" (click)="saveEditTask()"></button>
225+
<button pButton type="button" label="Save changes" icon="pi pi-check" [loading]="isSavingTask" [disabled]="!taskForm.title.trim() || taskForm.title.trim().length > 200" (click)="saveEditTask()"></button>
226226
</div>
227227
</div>
228228
</div>

src/app/features/task-item/components/user-task-items/user-task-items.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ interface ProjectFilterOption {
3636
styleUrl: './user-task-items.component.scss'
3737
})
3838
export class UserTaskItemsComponent implements OnInit, OnDestroy {
39+
private static readonly TITLE_MAX_LENGTH = 200;
3940
private static readonly PROJECT_SELECTION_CONTEXT = 'my-tasks';
4041
private readonly taskItemsApiClient = inject(TaskItemsApiClient);
4142
private readonly authService = inject(AuthService);
@@ -289,6 +290,15 @@ export class UserTaskItemsComponent implements OnInit, OnDestroy {
289290
return;
290291
}
291292

293+
if (title.length > UserTaskItemsComponent.TITLE_MAX_LENGTH) {
294+
this.messageService.add({
295+
severity: 'warn',
296+
summary: 'Title too long',
297+
detail: `Task title must be ${UserTaskItemsComponent.TITLE_MAX_LENGTH} characters or fewer.`
298+
});
299+
return;
300+
}
301+
292302
const task = this.tasks.find((entry) => entry.id === taskId);
293303
if (!task || !this.canEditTask(task)) {
294304
return;

0 commit comments

Comments
 (0)