aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/alert.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-09-12 11:17:48 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-09-12 11:17:48 +0100
commite15138c9501a85bcafb0099b1a594035fadcc911 (patch)
treed87d49fdc8c7f27f1b0c43872c69417d067b4303 /lib/mauve/alert.rb
parentdfd1254dcb524adec0419ba1a84f1f4817f90d88 (diff)
Reminders are now unconditionally cleared when an alert is cleared.
Diffstat (limited to 'lib/mauve/alert.rb')
-rw-r--r--lib/mauve/alert.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/mauve/alert.rb b/lib/mauve/alert.rb
index 786ecab..ecea4e6 100644
--- a/lib/mauve/alert.rb
+++ b/lib/mauve/alert.rb
@@ -356,11 +356,25 @@ module Mauve
self.update_type = "cleared"
end
- unless save
+ if save
+ #
+ # Clear all reminders.
+ #
+ self.changes.all(:remind_at.not => nil, :at.lte => at, :update_type => "raised").each do |ac|
+ ac.remind_at = nil
+ ac.save
+ end
+
+ #
+ # Return true.
+ #
+ true
+ else
+ #
+ # Oops.
+ #
logger.error("Couldn't save #{self}")
false
- else
- true
end
end