Skip to content

Commit 22a2e29

Browse files
committed
Added an send_email field to BallotPostitionDocEvent to reflect whether the 'Send email' button was used to save the ballot position. Reverted a different earlier schema change which had the same purpose. Added icons on documents' IESG evaluation record to reflect this.
- Legacy-Id: 15526
1 parent 232774a commit 22a2e29

8 files changed

Lines changed: 59 additions & 57 deletions

ietf/doc/admin.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
DocHistoryAuthor, DocHistory, DocAlias, DocReminder, DocEvent, NewRevisionDocEvent,
88
StateDocEvent, ConsensusDocEvent, BallotType, BallotDocEvent, WriteupDocEvent, LastCallDocEvent,
99
TelechatDocEvent, BallotPositionDocEvent, ReviewRequestDocEvent, InitialReviewDocEvent,
10-
BallotCommentDocEvent,
1110
AddedMessageEvent, SubmissionDocEvent, DeletedEvent, EditedAuthorsDocEvent, DocumentURL)
1211

1312

@@ -196,7 +195,6 @@ def short_desc(self, obj):
196195
admin.site.register(StateDocEvent, DocEventAdmin)
197196
admin.site.register(ConsensusDocEvent, DocEventAdmin)
198197
admin.site.register(BallotDocEvent, DocEventAdmin)
199-
admin.site.register(BallotCommentDocEvent, DocEventAdmin)
200198
admin.site.register(WriteupDocEvent, DocEventAdmin)
201199
admin.site.register(LastCallDocEvent, DocEventAdmin)
202200
admin.site.register(TelechatDocEvent, DocEventAdmin)

ietf/doc/migrations/0006_ballotcommentdocevent.py

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.15 on 2018-10-03 06:39
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('doc', '0005_fix_replaced_iab_irtf_stream_docs'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='ballotpositiondocevent',
17+
name='send_email',
18+
field=models.NullBooleanField(default=None),
19+
),
20+
]

ietf/doc/models.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,15 @@ def all_positions(self):
11031103
positions.sort(key=lambda p: (p.old_ad, p.ad.last_name()))
11041104
return positions
11051105

1106+
@memoize
1107+
def any_email_sent(self):
1108+
# When the send_email field is introduced, old positions will have it
1109+
# set to None. We sill essentially return True, False, or don't know:
1110+
sent_list = BallotPositionDocEvent.objects.filter(ballot=self, send_email=True).values_list('send_email', flat=True)
1111+
false = any( s==False for s in sent_list )
1112+
true = any( s==True for s in sent_list )
1113+
return True if true else False if false else None
1114+
11061115
class BallotPositionDocEvent(DocEvent):
11071116
ballot = ForeignKey(BallotDocEvent, null=True, default=None) # default=None is a temporary migration period fix, should be removed when charter branch is live
11081117
ad = ForeignKey(Person)
@@ -1111,9 +1120,7 @@ class BallotPositionDocEvent(DocEvent):
11111120
discuss_time = models.DateTimeField(help_text="Time discuss text was written", blank=True, null=True)
11121121
comment = models.TextField(help_text="Optional comment", blank=True)
11131122
comment_time = models.DateTimeField(help_text="Time optional comment was written", blank=True, null=True)
1114-
1115-
class BallotCommentDocEvent(DocEvent):
1116-
send_email = models.BooleanField(default=False)
1123+
send_email = models.NullBooleanField(default=None)
11171124

11181125
class WriteupDocEvent(DocEvent):
11191126
text = models.TextField(blank=True)

ietf/doc/resources.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
TelechatDocEvent, DocReminder, LastCallDocEvent, NewRevisionDocEvent, WriteupDocEvent,
1313
InitialReviewDocEvent, DocHistoryAuthor, BallotDocEvent, RelatedDocument,
1414
RelatedDocHistory, BallotPositionDocEvent, AddedMessageEvent, SubmissionDocEvent,
15-
ReviewRequestDocEvent, EditedAuthorsDocEvent, BallotCommentDocEvent, DocumentURL)
15+
ReviewRequestDocEvent, EditedAuthorsDocEvent, DocumentURL)
1616

1717
from ietf.name.resources import BallotPositionNameResource, DocTypeNameResource
1818
class BallotTypeResource(ModelResource):
@@ -650,25 +650,3 @@ class Meta:
650650
api.doc.register(DocumentURLResource())
651651

652652

653-
from ietf.person.resources import PersonResource
654-
class BallotCommentDocEventResource(ModelResource):
655-
by = ToOneField(PersonResource, 'by')
656-
doc = ToOneField(DocumentResource, 'doc')
657-
docevent_ptr = ToOneField(DocEventResource, 'docevent_ptr')
658-
class Meta:
659-
queryset = BallotCommentDocEvent.objects.all()
660-
serializer = api.Serializer()
661-
cache = SimpleCache()
662-
#resource_name = 'ballotcommentdocevent'
663-
filtering = {
664-
"id": ALL,
665-
"time": ALL,
666-
"type": ALL,
667-
"rev": ALL,
668-
"desc": ALL,
669-
"send_email": ALL,
670-
"by": ALL_WITH_RELATIONS,
671-
"doc": ALL_WITH_RELATIONS,
672-
"docevent_ptr": ALL_WITH_RELATIONS,
673-
}
674-
api.doc.register(BallotCommentDocEventResource())

ietf/doc/views_ballot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import debug # pyflakes:ignore
1717

1818
from ietf.doc.models import ( Document, State, DocEvent, BallotDocEvent, BallotPositionDocEvent,
19-
BallotCommentDocEvent, LastCallDocEvent, WriteupDocEvent, IESG_SUBSTATE_TAGS )
19+
LastCallDocEvent, WriteupDocEvent, IESG_SUBSTATE_TAGS )
2020
from ietf.doc.utils import ( add_state_change_event, close_ballot, close_open_ballots,
2121
create_ballot_if_not_open, update_telechat )
2222
from ietf.doc.mails import ( email_ballot_deferred, email_ballot_undeferred,
@@ -127,6 +127,7 @@ def save_position(form, doc, ballot, ad, login=None, send_email=False):
127127
pos.comment = clean["comment"].rstrip()
128128
pos.comment_time = old_pos.comment_time if old_pos else None
129129
pos.discuss = clean["discuss"].rstrip()
130+
pos.send_email = send_email
130131
if not pos.pos.blocking:
131132
pos.discuss = ""
132133
pos.discuss_time = old_pos.discuss_time if old_pos else None
@@ -141,7 +142,7 @@ def save_position(form, doc, ballot, ad, login=None, send_email=False):
141142
changes.append("comment")
142143

143144
if pos.comment:
144-
e = BallotCommentDocEvent(doc=doc, rev=doc.rev, by=ad, send_email=send_email)
145+
e = DocEvent(doc=doc, rev=doc.rev, by=ad)
145146
e.type = "added_comment"
146147
e.desc = "[Ballot comment]\n" + pos.comment
147148

@@ -153,7 +154,7 @@ def save_position(form, doc, ballot, ad, login=None, send_email=False):
153154
changes.append("discuss")
154155

155156
if pos.pos.blocking:
156-
e = BallotCommentDocEvent(doc=doc, rev=doc.rev, by=ad, send_email=send_email)
157+
e = DocEvent(doc=doc, rev=doc.rev, by=ad)
157158
e.type = "added_comment"
158159
e.desc = "[Ballot %s]\n" % pos.pos.name.lower()
159160
e.desc += pos.discuss

ietf/templates/doc/document_ballot_content.html

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,18 @@ <h4 class="anchor-target" id="{{ p.ad.plain_name|slugify }}">
9191
{% if p.pos.blocking and p.discuss %}
9292
<div class="panel panel-danger">
9393
<div class="panel-heading">
94-
<h5 class="panel-title"><b>{{ p.pos.name }}</b> ({{ p.discuss_time|date:"Y-m-d" }}{% if not p.for_current_revision %} for -{{ p.get_dochistory.rev}}{% endif %})</h5>
94+
<h5 class="panel-title">
95+
<b>{{ p.pos.name }}</b> ({{ p.discuss_time|date:"Y-m-d" }}{% if not p.for_current_revision %} for -{{ p.get_dochistory.rev}}{% endif %})
96+
{% if p.send_email %}
97+
<span class="fa fa-envelope-o pull-right" title="Email requested to be sent for this discuss"></span>
98+
{% elif p.ballot.any_email_sent == True %}
99+
<span class="fa fa-envelope pull-right" title="Email requested to be sent for earlier discuss"></span>
100+
{% elif p.ballot.any_email_sent == False %}
101+
<span class="fa fa-exclamation-triangle pull-right" title="No email send requests for this discuss"></span>
102+
{% else %}
103+
<span class="pull-right small italic" style="margin-top: -0.3em;" title="No ballot position send log available">No email<br/>send info</span>
104+
{% endif %}
105+
</h5>
95106
</div>
96107
<div class="panel-body"><pre class="ballot pasted">{{ p.discuss|linkify }}</pre></div>
97108
</div>
@@ -100,7 +111,18 @@ <h5 class="panel-title"><b>{{ p.pos.name }}</b> ({{ p.discuss_time|date:"Y-m-d"
100111
{% if p.comment %}
101112
<div class="panel panel-{{ p.pos|pos_to_label }}">
102113
<div class="panel-heading">
103-
<h5 class="panel-title"><b>Comment</b> ({{ p.comment_time|date:"Y-m-d" }}{% if not p.for_current_revision %} for -{{ p.get_dochistory.rev}}{% endif %})</h5>
114+
<h5 class="panel-title">
115+
<b>Comment</b> ({{ p.comment_time|date:"Y-m-d" }}{% if not p.for_current_revision %} for -{{ p.get_dochistory.rev}}{% endif %})
116+
{% if p.send_email %}
117+
<span class="fa fa-envelope-o pull-right" title="Email requested to be sent for this comment"></span>
118+
{% elif p.ballot.any_email_sent == True %}
119+
<span class="fa fa-envelope pull-right" title="Email requested to be sent for earlier comment"></span>
120+
{% elif p.ballot.any_email_sent == False %}
121+
<span class="fa fa-exclamation-triangle pull-right" title="No email send requests for this comment"></span>
122+
{% else %}
123+
<div class="pull-right small italic" style="margin-top: -0.3em;" title="No ballot position send log available">No email<br/>send info</div>
124+
{% endif %}
125+
</h5>
104126
</div>
105127
<div class="panel-body"><pre class="ballot pasted">{{ p.comment|linkify }}</pre></div>
106128
</div>

release-coverage.json.gz

86.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)