[damned-lies] Allow the coordinator to cancel reserved actions
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Allow the coordinator to cancel reserved actions
- Date: Fri, 14 Sep 2012 13:09:07 +0000 (UTC)
commit 4a0bfd4a5f9c72b9253e1ff816038b538f1886d3
Author: Claude Paroz <claude 2xlibre net>
Date: Fri Sep 14 15:06:55 2012 +0200
Allow the coordinator to cancel reserved actions
This is to prevent the case where someone reserves a module, then
disappears and the coordinator can then only archive all the actions.
Now he will be able to cancel the action to keep the current history.
vertimus/models.py | 4 ++++
vertimus/tests/__init__.py | 18 +++++++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/vertimus/models.py b/vertimus/models.py
index 50b0c92..65a4836 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -91,6 +91,10 @@ class State(models.Model):
def _get_available_actions(self, person, action_names):
action_names.append('WC')
+ # Allow the coordinator to cancel current reserved state
+ if person.is_coordinator(self.language.team) and \
+ self.name.endswith('ing') and 'UNDO' not in action_names:
+ action_names.append('UNDO')
if person.is_committer(self.language.team) and 'IC' not in action_names:
action_names.extend(('Separator', 'IC', 'AA'))
return [eval('Action' + action_name)() for action_name in action_names]
diff --git a/vertimus/tests/__init__.py b/vertimus/tests/__init__.py
index 7ae11bd..dce4353 100644
--- a/vertimus/tests/__init__.py
+++ b/vertimus/tests/__init__.py
@@ -87,9 +87,11 @@ class VertimusTest(TeamsAndRolesTests):
action_names = [a.name for a in state.get_available_actions(p)]
self.assertEqual(action_names, ['WC'])
- for p in (self.pc, self.pcoo):
- action_names = [a.name for a in state.get_available_actions(p)]
- self.assertEqual(action_names, ['WC', None, 'IC', 'AA'])
+ action_names = [a.name for a in state.get_available_actions(self.pc)]
+ self.assertEqual(action_names, ['WC', None, 'IC', 'AA'])
+
+ action_names = [a.name for a in state.get_available_actions(self.pcoo)]
+ self.assertEqual(action_names, ['WC', 'UNDO', None, 'IC', 'AA'])
# Same person
action_names = [a.name for a in state.get_available_actions(self.pt)]
@@ -118,9 +120,11 @@ class VertimusTest(TeamsAndRolesTests):
action_names = [a.name for a in state.get_available_actions(p)]
self.assertEqual(action_names, ['WC'])
- for p in (self.pc, self.pcoo):
- action_names = [a.name for a in state.get_available_actions(p)]
- self.assertEqual(action_names, ['WC', None, 'IC', 'AA'])
+ action_names = [a.name for a in state.get_available_actions(self.pc)]
+ self.assertEqual(action_names, ['WC', None, 'IC', 'AA'])
+
+ action_names = [a.name for a in state.get_available_actions(self.pcoo)]
+ self.assertEqual(action_names, ['WC', 'UNDO', None, 'IC', 'AA'])
# Same person and reviewer
action_names = [a.name for a in state.get_available_actions(self.pr)]
@@ -173,7 +177,7 @@ class VertimusTest(TeamsAndRolesTests):
self.assertEqual(action_names, ['WC'])
action_names = [a.name for a in state.get_available_actions(self.pcoo)]
- self.assertEqual(action_names, ['WC', None, 'IC', 'AA'])
+ self.assertEqual(action_names, ['WC', 'UNDO', None, 'IC', 'AA'])
action_names = [a.name for a in state.get_available_actions(self.pc)]
self.assertEqual(action_names, ['IC', 'TR', 'UNDO', 'WC'])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]