Skip to content

Commit 5fe04e3

Browse files
author
Richard Jones
committed
Handle "unset" status in status auditor [SF#621250]
Issues in 'done-cbb' are now also moved to 'chatting' on new messages
1 parent 637ca83 commit 5fe04e3

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

roundup/templates/classic/detectors/statusauditor.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
2020
#
21-
#$Id: statusauditor.py,v 1.2 2002-09-10 01:07:06 richard Exp $
21+
#$Id: statusauditor.py,v 1.3 2002-10-11 01:26:05 richard Exp $
2222

2323
def chatty(db, cl, nodeid, newvalues):
24-
''' If the issue is currently 'unread' or 'resolved', then set
24+
''' If the issue is currently 'unread', 'resolved' or 'done-cbb', then set
2525
it to 'chatting'
2626
'''
2727
# don't fire if there's no new message (ie. chat)
@@ -30,10 +30,12 @@ def chatty(db, cl, nodeid, newvalues):
3030
if newvalues['messages'] == cl.get(nodeid, 'messages', cache=0):
3131
return
3232

33-
# determine the id of 'unread', 'resolved' and 'chatting'
34-
unread_id = db.status.lookup('unread')
35-
resolved_id = db.status.lookup('resolved')
36-
chatting_id = db.status.lookup('chatting')
33+
# get the chatting state ID
34+
try:
35+
chatting_id = db.status.lookup('chatting')
36+
except KeyError:
37+
# no chatting state, ignore all this stuff
38+
return
3739

3840
# get the current value
3941
current_status = cl.get(nodeid, 'status')
@@ -43,15 +45,25 @@ def chatty(db, cl, nodeid, newvalues):
4345
# yep, skip
4446
return
4547

46-
# ok, there's no explicit change, so do it manually
47-
if current_status in (unread_id, resolved_id):
48+
# determine the id of 'unread', 'resolved' and 'chatting'
49+
fromstates = []
50+
for state in 'unread resolved done-cbb'.split():
51+
try:
52+
fromstates.append(db.status.lookup(state))
53+
except KeyError:
54+
pass
55+
56+
# ok, there's no explicit change, so check if we are in a state that
57+
# should be changed
58+
if current_status in fromstates:
59+
# yep, we're now chatting
4860
newvalues['status'] = chatting_id
4961

5062

5163
def presetunread(db, cl, nodeid, newvalues):
5264
''' Make sure the status is set on new issues
5365
'''
54-
if newvalues.has_key('status'):
66+
if newvalues.has_key('status') and newvalues['status']:
5567
return
5668

5769
# ok, do it

0 commit comments

Comments
 (0)