From dcb3e595484e5318d0a64770e7ac18f56c7b7099 Mon Sep 17 00:00:00 2001 From: Harry Kakoulidis Date: Tue, 29 Dec 2020 20:56:17 +0200 Subject: [PATCH] For automatic action "Send a task by email to someone", the Subject of the e-mail can contain a template using interpolation expressions (with double braces). For example, to have the email's subject look like (e.g. task moved to column "Done"): Done: Make sales report (#1000) Add the following action: > Send a task by email to someone Event name = Move a task to another column Column = Done User that will receive the email = Harry Email subject = {{column_title}}: {{title}} (#{{id}}) --- app/Action/TaskEmail.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Action/TaskEmail.php b/app/Action/TaskEmail.php index 5a8b5518e..8a18299af 100644 --- a/app/Action/TaskEmail.php +++ b/app/Action/TaskEmail.php @@ -80,12 +80,18 @@ class TaskEmail extends Base public function doAction(array $data) { $user = $this->userModel->getById($this->getParam('user_id')); + $subject = $this->getParam('subject'); + + foreach ($data["task"] as $key => $value) { + $placeholder = sprintf('{{%s}}', $key); + $subject = str_replace($placeholder, $value, $subject); + } if (! empty($user['email'])) { $this->emailClient->send( $user['email'], $user['name'] ?: $user['username'], - $this->getParam('subject'), + $subject, $this->template->render('notification/task_create', array( 'task' => $data['task'], ))