From d4fbecf1ba84bb172fa56a1ee35ec233e3e720df Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 2 Aug 2001 05:55:25 +0000 Subject: [PATCH] Web edit messages aren't sent to the person who did the edit any more. No message is generated if they are the only person on the nosy list. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@192 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/cgi_client.py | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index 52e7cad..3c497c0 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -1,4 +1,4 @@ -# $Id: cgi_client.py,v 1.15 2001-08-02 00:34:10 richard Exp $ +# $Id: cgi_client.py,v 1.16 2001-08-02 05:55:25 richard Exp $ import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes @@ -21,6 +21,9 @@ class Client: self.headers_done = 0 self.debug = 0 + def getuid(self): + return self.db.user.lookup(self.user) + def header(self, headers={'Content-Type':'text/html'}): if not headers.has_key('Content-Type'): headers['Content-Type'] = 'text/html' @@ -344,10 +347,21 @@ class Client: link = self.db.classes[link] link.set(nodeid, **{property: nid}) - # if this item has messages, - if (cl.getprops().has_key('messages') and - cl.getprops()['messages'].isMultilinkType and - cl.getprops()['messages'].classname == 'msg'): + # see if we want to send a message to the nosy list... + props = cl.getprops() + # don't do the message thing if there's no nosy list, or the editor + # of the node is the only person on the nosy list - they're already + # aware of the change. + nosy = 0 + if props.has_key('nosy'): + nosy = cl.get(nid, 'nosy') + uid = self.getuid() + if len(nosy) == 1 and uid in nosy: + nosy = 0 + if (nosy and props.has_key('messages') and + props['messages'].isMultilinkType and + props['messages'].classname == 'msg'): + # handle the note note = None if self.form.has_key('__note'): @@ -365,8 +379,8 @@ class Client: m.append('\n-------\n') # generate an edit message - nosyreactor will send it - for name, prop in cl.getprops().items(): - value = cl.get(nid, name) + for name, prop in props.items(): + value = cl.get(nid, name, None) if prop.isLinkType: link = self.db.classes[prop.classname] key = link.getkey() @@ -375,6 +389,7 @@ class Client: else: value = '-' elif prop.isMultilinkType: + if value is None: value = [] l = [] link = self.db.classes[prop.classname] for entry in value: @@ -388,8 +403,10 @@ class Client: # now create the message content = '\n'.join(m) - message_id = self.db.msg.create(author='1', recipients=[], - date=date.Date('.'), summary=summary, content=content) + nosy.remove(self.getuid()) + message_id = self.db.msg.create(author=self.getuid(), + recipients=nosy, date=date.Date('.'), summary=summary, + content=content) messages = cl.get(nid, 'messages') messages.append(message_id) props = {'messages': messages} @@ -519,6 +536,9 @@ class Client: # # $Log: not supported by cvs2svn $ +# Revision 1.15 2001/08/02 00:34:10 richard +# bleah syntax error +# # Revision 1.14 2001/08/02 00:26:16 richard # Changed the order of the information in the message generated by web edits. # -- 2.30.2