From 523acaf4501313b2462bb21f90f248d5d8e4d932 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 4 Jul 2011 12:37:53 +0100 Subject: Fixed up some templates. --- lib/mauve/alert.rb | 12 ++++++++++-- lib/mauve/notifiers/templates/email.html.erb | 2 +- lib/mauve/notifiers/templates/email.txt.erb | 2 +- lib/mauve/notifiers/templates/xmpp.txt.erb | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/mauve/alert.rb b/lib/mauve/alert.rb index 6dc3216..7768f50 100644 --- a/lib/mauve/alert.rb +++ b/lib/mauve/alert.rb @@ -375,7 +375,12 @@ module Mauve # if raise_time if raise_time <= (reception_time + 5) - alert_db.raised_at = raise_time + # + # Don't reset the raised_at time if the alert is already raised. + # This prevents the raised time constantly changing on alerts + # that are already raised. + # + alert_db.raised_at = raise_time unless was_raised or alert_db.raised_at.nil? alert_db.will_raise_at = nil else alert_db.raised_at = nil @@ -385,7 +390,10 @@ module Mauve if clear_time if clear_time <= (reception_time + 5) - alert_db.cleared_at = clear_time + # + # Don't reset the cleared_at time (see above for raised_at timings). + # + alert_db.cleared_at = clear_time unless was_cleared or alert_db.cleared_at.nil? alert_db.will_clear_at = nil else alert_db.cleared_at = nil diff --git a/lib/mauve/notifiers/templates/email.html.erb b/lib/mauve/notifiers/templates/email.html.erb index 46b2ebc..929237a 100644 --- a/lib/mauve/notifiers/templates/email.html.erb +++ b/lib/mauve/notifiers/templates/email.html.erb @@ -17,6 +17,6 @@ end %>.


Detail

-
<%=alert.detail %>
+
<%= RedCloth.new(alert.detail).to_html %>

--
Love mauve
xxx.
diff --git a/lib/mauve/notifiers/templates/email.txt.erb b/lib/mauve/notifiers/templates/email.txt.erb index 5db9bd6..7f4f081 100644 --- a/lib/mauve/notifiers/templates/email.txt.erb +++ b/lib/mauve/notifiers/templates/email.txt.erb @@ -15,7 +15,7 @@ end -- Detail ------------------------------------------------------------ -<%= Sanitize.clean(alert.detail) %> +<%= Alert.remove_html(alert.detail) %> ----------------------------------------------------------------------- diff --git a/lib/mauve/notifiers/templates/xmpp.txt.erb b/lib/mauve/notifiers/templates/xmpp.txt.erb index 282f370..c123038 100644 --- a/lib/mauve/notifiers/templates/xmpp.txt.erb +++ b/lib/mauve/notifiers/templates/xmpp.txt.erb @@ -3,7 +3,7 @@ case alert.update_type.to_sym when :cleared %><%= alert.cleared_at.to_s_relative %><% when :acknowleged -%><%= alert.acknowledged_at.to_s_relative %><% +%><%= alert.acknowledged_at.to_s_relative %> by <%= alert.acknowledged_by %><% else %><%= alert.raised_at.to_s_relative %><% end -- cgit v1.2.1