Add comments to tasks
Everyone who may change a task's status (attached subcontractors too) comments on it on the job page. Authors edit and remove their own comments; admin and management may remove anyone's (jobs.remove-any-task-comment). Edited comments show when they were edited, and task cards show the number of comments. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -147,6 +147,11 @@ class EloquentTaskQueries implements TaskQueries
|
||||
$userNames = $this->users->namesByIds($members->flatten()->pluck('user_id')
|
||||
->merge($models->pluck('assignee_user_id')->filter())
|
||||
->map(fn ($id): int => (int) $id)->unique()->values()->all());
|
||||
$commentCounts = DB::table('task_comments')
|
||||
->whereIn('task_id', $models->pluck('id')->all())
|
||||
->groupBy('task_id')
|
||||
->selectRaw('task_id, count(*) as aggregate')
|
||||
->pluck('aggregate', 'task_id');
|
||||
|
||||
$workTypeNames = [];
|
||||
foreach ($models->pluck('work_type_id')->unique() as $workTypeId) {
|
||||
@@ -170,6 +175,7 @@ class EloquentTaskQueries implements TaskQueries
|
||||
->all(),
|
||||
plannedFrom: $model->planned_from?->format('Y-m-d'),
|
||||
plannedTo: $model->planned_to?->format('Y-m-d'),
|
||||
commentCount: (int) ($commentCounts[$model->id] ?? 0),
|
||||
))->values()->all();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user