Code

. Modified cgi interface to change properties only once all changes are
[roundup.git] / roundup / templates / classic / detectors / nosyreaction.py
index b81e587ce801a9913fcca7eac7a08a2b5822036f..1088aa09c4edee5b86950942f1acb1614a706b56 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: nosyreaction.py,v 1.8 2001-12-05 14:26:44 rochecompaan Exp $
+#$Id: nosyreaction.py,v 1.9 2001-12-15 19:24:39 rochecompaan Exp $
 
 from roundup import roundupdb
 
@@ -35,6 +35,7 @@ def nosyreaction(db, cl, nodeid, oldvalues):
         then provides a log of when the message was sent to whom. 
     '''
     messages = []
+    change_note = ''
     if oldvalues is None:
         # the action was a create, so use all the messages in the create
         messages = cl.get(nodeid, 'messages')
@@ -48,13 +49,15 @@ def nosyreaction(db, cl, nodeid, oldvalues):
         for msgid in cl.get(nodeid, 'messages'):
             if not m.has_key(msgid):
                 messages.append(msgid)
+        if messages:
+            change_note = cl.generateChangeNote(nodeid, oldvalues)
     if not messages:
         return
 
     # send a copy to the nosy list
     for msgid in messages:
         try:
-            cl.sendmessage(nodeid, msgid)
+            cl.sendmessage(nodeid, msgid, change_note)
         except roundupdb.MessageSendError, message:
             raise roundupdb.DetectorError, message
 
@@ -63,15 +66,17 @@ def nosyreaction(db, cl, nodeid, oldvalues):
     n = {}
     for nosyid in nosy: n[nosyid] = 1
     change = 0
-    # but don't add admin or the anonymous user to the nosy list
+    # but don't add admin or the anonymous user to the nosy list and
+    # don't add the author if he just removed himself
     for msgid in messages:
+        authid = db.msg.get(msgid, 'author')
         for recipid in db.msg.get(msgid, 'recipients'):
             if recipid == '1': continue
             if n.has_key(recipid): continue
             if db.user.get(recipid, 'username') == 'anonymous': continue
+            if recipid == authid and not n.has_key(authid): continue
             change = 1
             nosy.append(recipid)
-        authid = db.msg.get(msgid, 'author')
         if authid == '1': continue
         if n.has_key(authid): continue
         if db.user.get(authid, 'username') == 'anonymous': continue
@@ -89,6 +94,10 @@ def init(db):
 
 #
 #$Log: not supported by cvs2svn $
+#Revision 1.8  2001/12/05 14:26:44  rochecompaan
+#Removed generation of change note from "sendmessage" in roundupdb.py.
+#The change note is now generated when the message is created.
+#
 #Revision 1.7  2001/11/30 11:29:04  rochecompaan
 #Property changes are now listed in emails generated by Roundup
 #