From b7344f98d0b7c8a287909b5c5d8bbaf0bc63ba7c Mon Sep 17 00:00:00 2001
From: Brian Moe <brian.moe@ligo.org>
Date: Thu, 31 Jan 2013 14:41:42 -0600
Subject: [PATCH] Add filename to XMPP alert for uploads.  Issue 712

---
 gracedb/alert.py | 4 ++--
 gracedb/api.py   | 2 +-
 gracedb/views.py | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gracedb/alert.py b/gracedb/alert.py
index f61d4353a..24d1b0dc7 100644
--- a/gracedb/alert.py
+++ b/gracedb/alert.py
@@ -30,9 +30,9 @@ def prepareSummary(event):
     return "GPS Time: %s" % event.gpstime
 
 
-def issueAlertForUpdate(event, description, doxmpp):
+def issueAlertForUpdate(event, description, doxmpp, filename=""):
     if doxmpp:
-        issueXMPPAlert(event, "", "", "update", description)
+        issueXMPPAlert(event, filename, "", "update", description)
     # XXX No emails for this.  Argh.
 
 def issueAlertForLabel(event, label, doxmpp):
diff --git a/gracedb/api.py b/gracedb/api.py
index 6064ca3fc..11157c5a8 100644
--- a/gracedb/api.py
+++ b/gracedb/api.py
@@ -803,7 +803,7 @@ class Files(APIView):
 
         try:
             description = "UPLOAD: {0}".format(filename)
-            issueAlertForUpdate(event, description, doxmpp=True)
+            issueAlertForUpdate(event, description, doxmpp=True, filename=filename)
         except:
             # XXX something should be done here.
             pass
diff --git a/gracedb/views.py b/gracedb/views.py
index 9515fc37e..3961a80c7 100644
--- a/gracedb/views.py
+++ b/gracedb/views.py
@@ -304,7 +304,7 @@ def _createLog(request, graceid, comment, uploadedFile=None):
             description = "LOG: "
             if uploadedFile:
                 description = "UPLOAD: '%s' " % uploadedFile.name
-            issueAlertForUpdate(event, description+comment, doxmpp=True)
+            issueAlertForUpdate(event, description+comment, doxmpp=True, filename=uploadedFile.name)
 
     # XXX should be json
     rval = str(rdict)
-- 
GitLab