aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-05-03 18:43:24 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-05-03 18:43:24 +0100
commit757853bb96c2f75bcb28f16fcf80601abee48033 (patch)
tree3f7fbd1b8340dea689a9cbe3c0cde933162e7660 /lib/mauve
parent442e97f45ca582fdfbdd57f558e9fa82c8dfd4d3 (diff)
Username is now recorded in the History wherever possible.
Diffstat (limited to 'lib/mauve')
-rw-r--r--lib/mauve/notifiers/xmpp.rb2
-rw-r--r--lib/mauve/person.rb4
-rw-r--r--lib/mauve/pop3_server.rb2
-rw-r--r--lib/mauve/web_interface.rb4
4 files changed, 6 insertions, 6 deletions
diff --git a/lib/mauve/notifiers/xmpp.rb b/lib/mauve/notifiers/xmpp.rb
index 137ca74..323f89d 100644
--- a/lib/mauve/notifiers/xmpp.rb
+++ b/lib/mauve/notifiers/xmpp.rb
@@ -647,7 +647,7 @@ EOF
#
unless note.to_s.empty?
note = Alert.remove_html(note)
- h = History.new(:alerts => succeeded, :type => "note", :event => username+" noted "+note.to_s)
+ h = History.new(:alerts => succeeded, :type => "note", :event => note.to_s, :user => username)
logger.debug h.errors unless h.save
end
diff --git a/lib/mauve/person.rb b/lib/mauve/person.rb
index c1c12c6..6178fa0 100644
--- a/lib/mauve/person.rb
+++ b/lib/mauve/person.rb
@@ -205,7 +205,7 @@ 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)
+ h = History.new(:alerts => [@alert], :type => "notification", :event => note, :user => @person.username)
logger.error "Unable to save history due to #{h.errors.inspect}" if !h.save
return res
@@ -234,7 +234,7 @@ module Mauve
if @suppressed or self.is_on_holiday?(now) or self.is_off_sick?(now)
note = "#{alert.update_type.capitalize} notification to #{self.username} suppressed"
logger.info note + " about #{alert}."
- History.create(:alerts => [alert], :type => "notification", :event => note)
+ History.create(:alerts => [alert], :type => "notification", :event => note, :user => self.username)
return true
end
diff --git a/lib/mauve/pop3_server.rb b/lib/mauve/pop3_server.rb
index e7132f4..861b719 100644
--- a/lib/mauve/pop3_server.rb
+++ b/lib/mauve/pop3_server.rb
@@ -399,7 +399,7 @@ module Mauve
send_data ["+OK #{msg.length} octets", msg, "."].join(CRLF)
note = "#{alert_changed.update_type.capitalize} notification downloaded via POP3 by #{@user}"
logger.info note+" about #{alert_changed}."
- h = History.new(:alerts => [alert_changed.alert_id], :type => "notification", :event => note)
+ h = History.new(:alerts => [alert_changed.alert_id], :type => "notification", :event => note, :user => @user)
logger.error "Unable to save history due to #{h.errors.inspect}" if !h.save
else
send_data "-ERR Message not found."
diff --git a/lib/mauve/web_interface.rb b/lib/mauve/web_interface.rb
index fb19abd..5919bb6 100644
--- a/lib/mauve/web_interface.rb
+++ b/lib/mauve/web_interface.rb
@@ -252,7 +252,7 @@ EOF
#
unless note.to_s.empty?
note = Alert.remove_html(note)
- h = History.new(:alerts => succeeded, :type => "note", :event => session['username']+" noted "+note.to_s)
+ h = History.new(:alerts => succeeded, :type => "note", :event => note.to_s, :user => session['username'])
logger.debug h.errors unless h.save
end
@@ -377,7 +377,7 @@ EOF
# Add the note
#
unless note.to_s.empty?
- h = History.new(:alerts => [alert], :type => "note", :event => session['username']+" noted "+note.to_s)
+ h = History.new(:alerts => [alert], :type => "note", :event => note.to_s, :user => session['username'])
logger.debug h.errors unless h.save
end