[damned-lies] Fixed #762449 -- Don't let an action message after submitting to repository
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Fixed #762449 -- Don't let an action message after submitting to repository
- Date: Thu, 25 Feb 2016 07:18:54 +0000 (UTC)
commit 365b5b7c83f087dc9d8402607f91fffb36546fc5
Author: Claude Paroz <claude 2xlibre net>
Date: Thu Feb 25 08:17:18 2016 +0100
Fixed #762449 -- Don't let an action message after submitting to repository
Fixes a regression introduced by 04821c741b. Thanks Anders Jonsson for the
report.
vertimus/models.py | 5 ++---
vertimus/tests/tests.py | 6 ++++--
2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/vertimus/models.py b/vertimus/models.py
index e67eafd..5b0271f 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -470,12 +470,11 @@ class Action(ActionAbstract):
self.file.save(self.file.name, self.file, save=False)
if form_data.get('comment'):
self.comment = form_data['comment']
+ self.sent_to_ml = form_data.get('send_to_ml', False)
self.save()
- self.update_state()
+ self.update_state() # Do not save action after that, they have been archived
if form_data.get('send_to_ml'):
- self.sent_to_ml = True
- self.save()
self.send_mail_new_state(state, (state.language.team.mailing_list,))
elif self.send_mail_to_ml or self.comment:
# If the action is normally sent to ML (but unchecked) or if the form
diff --git a/vertimus/tests/tests.py b/vertimus/tests/tests.py
index b91b84e..ecae0ab 100644
--- a/vertimus/tests/tests.py
+++ b/vertimus/tests/tests.py
@@ -390,7 +390,7 @@ class VertimusTest(TeamsAndRolesTests):
state.save()
self.upload_file(state, 'UP', pers=pers)
form = ActionForm(state, state.get_available_actions(self.pcoo), True, {
- 'action': 'CI', 'author': '', 'comment': ''})
+ 'action': 'CI', 'author': '', 'comment': '', 'send_to_ml': True})
self.assertTrue(form.is_valid())
with patch_shell_command() as cmds:
action = Action.new_by_name('CI', person=self.pcoo)
@@ -398,7 +398,9 @@ class VertimusTest(TeamsAndRolesTests):
self.assertIn("git commit", cmds[-3])
self.assertNotIn("--author", cmds[-3])
self.assertEqual(msg, 'The file has been successfully committed to the repository.')
-
+ state.refresh_from_db()
+ # All actions should have been archived
+ self.assertEqual(state.action_set.count(), 0)
def test_action_ic(self):
state = StateProofreading(branch=self.b, domain=self.d, language=self.l, person=self.pr)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]