Commit 9e3ed259c9079c45929ce93597a2f32fc14c0461
1 parent
4fdb1cf0
Exists in
master
and in
22 other branches
rails3: fix task mail sending calls
Showing
1 changed file
with
5 additions
and
10 deletions
Show diff stats
app/models/task.rb
| @@ -57,8 +57,7 @@ class Task < ActiveRecord::Base | @@ -57,8 +57,7 @@ class Task < ActiveRecord::Base | ||
| 57 | after_create do |task| | 57 | after_create do |task| |
| 58 | unless task.status == Task::Status::HIDDEN | 58 | unless task.status == Task::Status::HIDDEN |
| 59 | begin | 59 | begin |
| 60 | - # FIXME | ||
| 61 | - # task.send(:send_notification, :created) | 60 | + task.send(:send_notification, :created) |
| 62 | rescue NotImplementedError => ex | 61 | rescue NotImplementedError => ex |
| 63 | Rails.logger.info ex.to_s | 62 | Rails.logger.info ex.to_s |
| 64 | end | 63 | end |
| @@ -66,8 +65,7 @@ class Task < ActiveRecord::Base | @@ -66,8 +65,7 @@ class Task < ActiveRecord::Base | ||
| 66 | begin | 65 | begin |
| 67 | target_msg = task.target_notification_message | 66 | target_msg = task.target_notification_message |
| 68 | if target_msg && task.target && !task.target.notification_emails.empty? | 67 | if target_msg && task.target && !task.target.notification_emails.empty? |
| 69 | - # FIXME | ||
| 70 | - # TaskMailer.deliver_target_notification(task, target_msg) | 68 | + TaskMailer.target_notification(task, target_msg).deliver |
| 71 | end | 69 | end |
| 72 | rescue NotImplementedError => ex | 70 | rescue NotImplementedError => ex |
| 73 | Rails.logger.info ex.to_s | 71 | Rails.logger.info ex.to_s |
| @@ -222,8 +220,7 @@ class Task < ActiveRecord::Base | @@ -222,8 +220,7 @@ class Task < ActiveRecord::Base | ||
| 222 | self.status = Task::Status::ACTIVE | 220 | self.status = Task::Status::ACTIVE |
| 223 | save! | 221 | save! |
| 224 | begin | 222 | begin |
| 225 | - # FIXME | ||
| 226 | - # self.send(:send_notification, :activated) | 223 | + self.send(:send_notification, :activated) |
| 227 | rescue NotImplementedError => ex | 224 | rescue NotImplementedError => ex |
| 228 | Rails.logger.info ex.to_s | 225 | Rails.logger.info ex.to_s |
| 229 | end | 226 | end |
| @@ -231,8 +228,7 @@ class Task < ActiveRecord::Base | @@ -231,8 +228,7 @@ class Task < ActiveRecord::Base | ||
| 231 | begin | 228 | begin |
| 232 | target_msg = target_notification_message | 229 | target_msg = target_notification_message |
| 233 | if target_msg && self.target && !self.target.notification_emails.empty? | 230 | if target_msg && self.target && !self.target.notification_emails.empty? |
| 234 | - # FIXME | ||
| 235 | - # TaskMailer.deliver_target_notification(self, target_msg) | 231 | + TaskMailer.target_notification(self, target_msg).deliver |
| 236 | end | 232 | end |
| 237 | rescue NotImplementedError => ex | 233 | rescue NotImplementedError => ex |
| 238 | Rails.logger.info ex.to_s | 234 | Rails.logger.info ex.to_s |
| @@ -265,8 +261,7 @@ class Task < ActiveRecord::Base | @@ -265,8 +261,7 @@ class Task < ActiveRecord::Base | ||
| 265 | def send_notification(action) | 261 | def send_notification(action) |
| 266 | if sends_email? | 262 | if sends_email? |
| 267 | if self.requestor | 263 | if self.requestor |
| 268 | - # FIXME | ||
| 269 | - # TaskMailer.send("deliver_task_#{action}", self) | 264 | + TaskMailer.generic_message("task_#{action}", self) |
| 270 | end | 265 | end |
| 271 | end | 266 | end |
| 272 | end | 267 | end |