[damned-lies] Store whether action message was sent to mailing list or not
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Store whether action message was sent to mailing list or not
- Date: Wed, 24 Feb 2016 15:49:13 +0000 (UTC)
commit 04821c741ba13cd2b7ac260fa43a664463744b49
Author: Claude Paroz <claude 2xlibre net>
Date: Wed Feb 24 16:46:49 2016 +0100
Store whether action message was sent to mailing list or not
Refs bug #762586. Missing interface display.
vertimus/migrations/0003_add_action_sent_to_ml.py | 24 +++++++++++++++++++++
vertimus/models.py | 3 ++
vertimus/tests/tests.py | 2 +
3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/vertimus/migrations/0003_add_action_sent_to_ml.py
b/vertimus/migrations/0003_add_action_sent_to_ml.py
new file mode 100644
index 0000000..7676d44
--- /dev/null
+++ b/vertimus/migrations/0003_add_action_sent_to_ml.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('vertimus', '0002_state_person_blank'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='action',
+ name='sent_to_ml',
+ field=models.BooleanField(default=False),
+ ),
+ migrations.AddField(
+ model_name='actionarchived',
+ name='sent_to_ml',
+ field=models.BooleanField(default=False),
+ ),
+ ]
diff --git a/vertimus/models.py b/vertimus/models.py
index 528f569..e67eafd 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -356,6 +356,7 @@ class ActionAbstract(models.Model):
name = models.SlugField(max_length=8)
created = models.DateTimeField(editable=False)
comment = models.TextField(blank=True, null=True)
+ sent_to_ml = models.BooleanField(default=False)
file = models.FileField(upload_to=generate_upload_filename, blank=True, null=True)
#up_file = models.OneToOneField(PoFile, null=True, related_name='action_p')
merged_file = models.OneToOneField(PoFile, blank=True, null=True) #, related_name='action_m')
@@ -473,6 +474,8 @@ class Action(ActionAbstract):
self.update_state()
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 9ddd0e0..b91b84e 100644
--- a/vertimus/tests/tests.py
+++ b/vertimus/tests/tests.py
@@ -237,6 +237,7 @@ class VertimusTest(TeamsAndRolesTests):
mail.outbox = []
action = Action.new_by_name('WC', person=self.pt)
action.apply_on(state, {'send_to_ml': True, 'comment': "Hi again!"})
+ self.assertTrue(action.sent_to_ml)
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(mail.outbox[0].recipients(), [self.l.team.mailing_list])
self.assertIn(u"Hi again!", mail.outbox[0].body)
@@ -294,6 +295,7 @@ class VertimusTest(TeamsAndRolesTests):
state = StateTranslated.objects.create(branch=self.b, domain=self.d, language=self.l)
action = Action.new_by_name('WC', person=self.pt)
action.apply_on(state, {'send_to_ml': False, 'comment': "Hi!"})
+ self.assertFalse(action.sent_to_ml)
# At least the coordinator receives the message
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(mail.outbox[0].recipients(), [self.l.team.get_coordinators()[0].email])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]