Commit 9e3ed259c9079c45929ce93597a2f32fc14c0461

Authored by Rodrigo Souto
1 parent 4fdb1cf0

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 57 after_create do |task|
58 58 unless task.status == Task::Status::HIDDEN
59 59 begin
60   - # FIXME
61   - # task.send(:send_notification, :created)
  60 + task.send(:send_notification, :created)
62 61 rescue NotImplementedError => ex
63 62 Rails.logger.info ex.to_s
64 63 end
... ... @@ -66,8 +65,7 @@ class Task < ActiveRecord::Base
66 65 begin
67 66 target_msg = task.target_notification_message
68 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 69 end
72 70 rescue NotImplementedError => ex
73 71 Rails.logger.info ex.to_s
... ... @@ -222,8 +220,7 @@ class Task < ActiveRecord::Base
222 220 self.status = Task::Status::ACTIVE
223 221 save!
224 222 begin
225   - # FIXME
226   - # self.send(:send_notification, :activated)
  223 + self.send(:send_notification, :activated)
227 224 rescue NotImplementedError => ex
228 225 Rails.logger.info ex.to_s
229 226 end
... ... @@ -231,8 +228,7 @@ class Task < ActiveRecord::Base
231 228 begin
232 229 target_msg = target_notification_message
233 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 232 end
237 233 rescue NotImplementedError => ex
238 234 Rails.logger.info ex.to_s
... ... @@ -265,8 +261,7 @@ class Task < ActiveRecord::Base
265 261 def send_notification(action)
266 262 if sends_email?
267 263 if self.requestor
268   - # FIXME
269   - # TaskMailer.send("deliver_task_#{action}", self)
  264 + TaskMailer.generic_message("task_#{action}", self)
270 265 end
271 266 end
272 267 end
... ...