Commit a4d2c4caff1ad798ca847914cab05e0b6de89997
Exists in
master
and in
27 other branches
Merge branch 'fix_notification_mail' into 'master'
Fix notification email Some tasks were not sending notification email (e.g., ChangePassword). Fix send_notification method from Task. See merge request !371
Showing
7 changed files
with
13 additions
and
15 deletions
Show diff stats
app/controllers/public/account_controller.rb
| @@ -193,7 +193,7 @@ class AccountController < ApplicationController | @@ -193,7 +193,7 @@ class AccountController < ApplicationController | ||
| 193 | else | 193 | else |
| 194 | @change_password.errors[:base] << _('Could not find any user with %s equal to "%s".') % [fields_label, params[:value]] | 194 | @change_password.errors[:base] << _('Could not find any user with %s equal to "%s".') % [fields_label, params[:value]] |
| 195 | end | 195 | end |
| 196 | - rescue ActiveRecord::RecordInvald | 196 | + rescue ActiveRecord::RecordInvalid |
| 197 | @change_password.errors[:base] << _('Could not perform password recovery for the user.') | 197 | @change_password.errors[:base] << _('Could not perform password recovery for the user.') |
| 198 | end | 198 | end |
| 199 | end | 199 | end |
app/models/task.rb
| @@ -285,8 +285,9 @@ class Task < ActiveRecord::Base | @@ -285,8 +285,9 @@ class Task < ActiveRecord::Base | ||
| 285 | # If | 285 | # If |
| 286 | def send_notification(action) | 286 | def send_notification(action) |
| 287 | if sends_email? | 287 | if sends_email? |
| 288 | - if self.requestor | ||
| 289 | - TaskMailer.generic_message("task_#{action}", self) | 288 | + if self.requestor && !self.requestor.notification_emails.empty? |
| 289 | + message = TaskMailer.generic_message("task_#{action}", self) | ||
| 290 | + message.deliver if message | ||
| 290 | end | 291 | end |
| 291 | end | 292 | end |
| 292 | end | 293 | end |
app/views/task_mailer/task_activated.text.erb
app/views/task_mailer/task_cancelled.text.erb
app/views/task_mailer/task_created.text.erb
app/views/task_mailer/task_finished.text.erb