From e15138c9501a85bcafb0099b1a594035fadcc911 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 12 Sep 2011 11:17:48 +0100 Subject: Reminders are now unconditionally cleared when an alert is cleared. --- lib/mauve/alert.rb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'lib') 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 -- cgit v1.2.1