aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2013-05-16 14:13:40 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2013-05-16 14:13:40 +0100
commit80f7fc72323233595269502860817df615b1c9df (patch)
tree0bf00ed96b7123b296811267a2c8e2aed20a6e33 /lib
parent46e55b62412cea23beba4efb7ee169245619b6de (diff)
parentfa7e7b8dc9d3f2333869703fc266405ee80cd5c8 (diff)
merge
Diffstat (limited to 'lib')
-rw-r--r--lib/mauve/notification.rb4
-rw-r--r--lib/mauve/person.rb15
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/mauve/notification.rb b/lib/mauve/notification.rb
index 745660a..c164afb 100644
--- a/lib/mauve/notification.rb
+++ b/lib/mauve/notification.rb
@@ -319,9 +319,7 @@ module Mauve
#
# A bit of alert de-bouncing.
#
- if already_sent_to.include?(person.username)
- logger.info("Already sent notification of #{alert} to #{person.username}")
- else
+ unless already_sent_to.include?(person.username)
person.send_alert(level, alert)
already_sent_to << person.username
end
diff --git a/lib/mauve/person.rb b/lib/mauve/person.rb
index 8ce0952..fd8cf98 100644
--- a/lib/mauve/person.rb
+++ b/lib/mauve/person.rb
@@ -253,10 +253,8 @@ module Mauve
#
# Log the result
- note = "#{@alert.update_type.capitalize} #{name} notification to #{@person.username} (#{destination}) " + (res ? "succeeded" : "failed" )
- logger.info note+" about #{@alert}."
- h = History.new(:alerts => [@alert], :type => "notification", :event => note, :user => @person.username)
- h.save
+ #
+ logger.info "#{@alert.update_type.capitalize} #{name} notification to #{@person.username} (#{destination}) " + (res ? "succeeded" : "failed" ) +" about #{@alert}."
return res
end
@@ -282,7 +280,7 @@ module Mauve
# and are still suppressed.
#
if @suppressed or self.is_on_holiday?(now) or self.is_off_sick?(now)
- note = "#{alert.update_type.capitalize} notification to #{self.username} suppressed"
+ note = "#{alert.update_type.capitalize} #{level} notification to #{self.username} suppressed"
logger.info note + " about #{alert}."
History.create(:alerts => [alert], :type => "notification", :event => note, :user => self.username)
return true
@@ -303,8 +301,13 @@ module Mauve
:was_suppressed => was_suppressed, }
).instance_eval(&__send__(level))
end
+
+ res = [result].flatten.any?
+
+ note = "#{alert.update_type.capitalize} #{level} notification to #{self.username} " + (res ? "succeeded" : "failed" )
+ History.create(:alerts => [alert], :type => "notification", :event => note, :user => self.username)
- return [result].flatten.any?
+ return res
end
#