diff --git a/be/app/Listeners/SendEditedMasterTaskNotification.php b/be/app/Listeners/SendEditedMasterTaskNotification.php index fffa569..790cbf5 100644 --- a/be/app/Listeners/SendEditedMasterTaskNotification.php +++ b/be/app/Listeners/SendEditedMasterTaskNotification.php @@ -43,7 +43,7 @@ class SendEditedMasterTaskNotification implements ShouldQueue $modelDiff = array_diff_assoc($editedMasterTaskArray, $originalMasterTaskArray); foreach ( $modelDiff as $key => $diff ) { - if (in_array($key, ['status', 'tracked_time'])) { + if (in_array($key, ['status', 'tracked_time', 'estimated_time', 'team_id'])) { continue; } diff --git a/be/app/Listeners/SendEditedSubTaskNotification.php b/be/app/Listeners/SendEditedSubTaskNotification.php index d35f9c0..503900a 100644 --- a/be/app/Listeners/SendEditedSubTaskNotification.php +++ b/be/app/Listeners/SendEditedSubTaskNotification.php @@ -66,7 +66,15 @@ class SendEditedSubTaskNotification implements ShouldQueue } } - $difference[$key] = $diff; + // aby nechodilo "Updated by: 63" + if ($key == 'updated_by' && $diff == 1) { + $user = User::find($diff); + $difference[$key] = ($user) ? $user->firstname . ' ' . $user->lastname : ''; + } else { + $difference[$key] = $diff; + } + + } if (empty($difference)) { diff --git a/be/app/Mail/NewTask.php b/be/app/Mail/NewTask.php index ed271ca..c9ec3e5 100644 --- a/be/app/Mail/NewTask.php +++ b/be/app/Mail/NewTask.php @@ -9,6 +9,7 @@ use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; use Illuminate\Queue\SerializesModels; +use Illuminate\Mail\Mailables\Address; class NewTask extends Mailable { @@ -16,6 +17,7 @@ class NewTask extends Mailable public $subtask; public $creator; + public $usersInMasterTask; /** * Create a new message instance. @@ -26,8 +28,11 @@ class NewTask extends Mailable { $creator = \App\Models\User::find($subtask->created_by); - $this->creator = ($creator) ? $creator->firstname . ' ' . $creator->lastname : ''; + $usersInMasterTask = $subtask->mastertask->allUsersInMasterTask(); + + $this->creator = $creator; $this->subtask = $subtask; + $this->usersInMasterTask = $usersInMasterTask; } /** @@ -38,7 +43,10 @@ class NewTask extends Mailable public function envelope() { return new Envelope( - subject: 'Bol vytvorený Sub Task ' . $this->subtask->mastertask->project->code . ' - ' . ($this->subtask->title) ?: $this->subtask->mastertask->title, + replyTo: [ + new Address($this->creator->email, ($this->creator) ? $this->creator->firstname . ' ' . $this->creator->lastname : ''), + ], + subject: $this->subtask->mastertask->project->code . ' ' . $this->subtask->mastertask->project->code . ' - vytvorený Sub Task', ); } diff --git a/be/app/Models/MasterTask.php b/be/app/Models/MasterTask.php index a685833..ffcf3c4 100644 --- a/be/app/Models/MasterTask.php +++ b/be/app/Models/MasterTask.php @@ -35,7 +35,6 @@ class MasterTask extends Model // vracia userov, ktori su priradeni k subtasku ale nepatria do teamu public function getUsersOutsideTeamAttribute() { - $users = $this->subtasks->pluck('user')->unique(); // ak nie je uvedeny ziaden team, tak sa vratia vsetci useri @@ -48,6 +47,12 @@ class MasterTask extends Model }); } + // vsetci useri, ktory pracuju na master tasku (tzn. maju vytvorene subtasky k danemu master tasku) + public function getAllUsersInMasterTaskAttribute() + { + return $this->subtasks->pluck('user')->unique(); + } + public static function generateMasterTaskColor() { // return random value from array diff --git a/be/resources/views/emails/task/sub_task_created.blade.php b/be/resources/views/emails/task/sub_task_created.blade.php index 66b0c38..63d64d6 100644 --- a/be/resources/views/emails/task/sub_task_created.blade.php +++ b/be/resources/views/emails/task/sub_task_created.blade.php @@ -1,5 +1,12 @@ -Task založil: {{$creator}}
+Task založil: {{($creator) ? $creator->firstname . ' ' . $creator->lastname : ''}}
Job number: {{$subtask->mastertask->project->code}}
Názov Tasku: {{($subtask->title) ?: $subtask->mastertask->title}}
Deadline do: {{($subtask->deadline) ?: $subtask->mastertask->deadline}}
-Odkaz na Task: {{ url( env( 'APP_URL_FE' ) . '/#/app/dashboard/tasks?subtask=' . $subtask->id) }}
+Ľudia v Master Tasku:
+ +@foreach($usersInMasterTask as $key => $user) + {{ $user->firstname }} {{ $user->lastname }}
+@endforeach + +Odkaz na Task: {{ url( env( 'APP_URL_FE' ) . '/#/app/dashboard/tasks?subtask=' . $subtask->id) }}

+Popis: {!!($subtask->description) ?: $subtask->mastertask->description !!}