--- ../../share/roundup/templates/classic/detectors/statusauditor.py 2016-06-05 10:50:37.000000000 -0400 +++ statusauditor.py 2016-10-01 15:16:00.431950200 -0400 @@ -20,9 +20,21 @@ # def chatty(db, cl, nodeid, newvalues): - ''' If the issue is currently 'unread', 'resolved', 'done-cbb' or None, - then set it to 'chatting' + ''' If the issue is currently 'resolved', 'done-cbb' or None, + then set it to 'chatting'. If issue is 'unread' and + allow_multiple_initial_emails is true, set state + to 'chatting' if the person adding the new message is not + the same as the person who opened the issue. This allows + somebody to submit multiple emails describing the problem + without changing it to 'chatting' which indicates at least + two people are 'chatting'. ''' + # If set to true, change state from 'unread' to 'chatting' only + # if the author of the update is not the person who created the + # first message (and thus the issue). If false (the default), + # set 'chatting' when the second message is received. + allow_multiple_initial_emails = False + # don't fire if there's no new message (ie. chat) if not newvalues.has_key('messages'): return @@ -52,8 +64,25 @@ except KeyError: pass + unread = fromstates[0] # grab the 'unread' state which is first + # ok, there's no explicit change, so check if we are in a state that - # should be changed + # should be changed. First see if we should set 'chatting' based on + # who opened the issue. + if current_status == unread and allow_multiple_initial_emails: + # find author of first message and compare + # is this author is same as initial author don't + # change to 'chatting'. + messages = cl.get(nodeid, 'messages') + if messages: + firstmessageid = messages[0] + initial_author = db.msg.get(firstmessageid, 'author') + if initial_author == db.getuid(): + # person is chatting with themselves, don't set 'chatting' + return + + # Current author is not the initiator of the issue so + # we are 'chatting'. if current_status in fromstates + [None]: # yep, we're now chatting newvalues['status'] = chatting_id @@ -82,3 +111,4 @@ db.issue.audit('create', presetunread) # vim: set filetype=python ts=4 sw=4 et si +#SHA: 3aafc622e20d33a2eb101ae4763158f5bc040bc6