Skip to content

Commit 4af33fc

Browse files
committed
fix(kanban): add missing currentUser, fix protected access, remove non-null assertions
- Add currentUser computed to KanbanBoardDetailInfoService (used by component but missing) - Change leaderId/collaborators from protected to public (accessed by TaskDetailComponent) - Replace collaborator()with local variable guard in task-detail.component - Replace days! with days ?? 0
1 parent 0f9ef1b commit 4af33fc

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

projects/social_platform/src/app/api/kanban/kanban-board-detail-info.service.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,18 @@ export class KanbanBoardDetailInfoService {
6363
private deleteTaskSubject = new Subject<number>();
6464
private readonly profile = this.profileInfoService.profile;
6565

66+
readonly currentUser = computed(() => {
67+
const p = this.profile();
68+
if (!p) return undefined;
69+
return { id: p.id, avatar: p.personal.avatar, firstName: p.firstName, lastName: p.lastName };
70+
});
71+
6672
setTaskDetailInfo(detail: TaskDetail | undefined) {
6773
this.taskDetail.set(detail);
6874
}
6975

70-
protected readonly leaderId = this.projectsDetailUIInfoService.leaderId;
71-
protected readonly collaborators = this.projectsDetailUIInfoService.collaborators;
76+
readonly leaderId = this.projectsDetailUIInfoService.leaderId;
77+
readonly collaborators = this.projectsDetailUIInfoService.collaborators;
7278

7379
isLeader = computed(() => {
7480
const user = this.profile();

projects/social_platform/src/app/ui/pages/projects/detail/kanban/components/task/detail/task-detail.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,9 @@ export class TaskDetailComponent implements OnInit, AfterViewInit, OnDestroy {
255255
}
256256

257257
get responsiblePickOpenOptions() {
258-
return this.collaborators()?.length
259-
? this.collaborators()!.map(collaborator => ({
258+
const collabs = this.collaborators();
259+
return collabs?.length
260+
? collabs.map(collaborator => ({
260261
id: collaborator.userId,
261262
label: collaborator.firstName + " " + collaborator.lastName[0],
262263
value: collaborator.userId,
@@ -266,8 +267,9 @@ export class TaskDetailComponent implements OnInit, AfterViewInit, OnDestroy {
266267
}
267268

268269
get goalPickOptions() {
269-
return this.goals()?.length
270-
? this.goals()!.map(goal => ({
270+
const items = this.goals();
271+
return items?.length
272+
? items.map(goal => ({
271273
id: goal.id,
272274
label: goal.title,
273275
value: goal.id,
@@ -313,7 +315,7 @@ export class TaskDetailComponent implements OnInit, AfterViewInit, OnDestroy {
313315
days = daysUntil(deadline);
314316
}
315317

316-
const color = status === "закончена" ? "red" : this.getColorByDays(days!);
318+
const color = status === "закончена" ? "red" : this.getColorByDays(days ?? 0);
317319

318320
return {
319321
text: status,

0 commit comments

Comments
 (0)