diff --git a/ietf/submit/tests.py b/ietf/submit/tests.py index 8779a0849..a0990eae7 100644 --- a/ietf/submit/tests.py +++ b/ietf/submit/tests.py @@ -373,10 +373,12 @@ class ApprovalsTestCase(django.test.TestCase): IdSubmissionDetail.objects.create(filename="draft-ietf-mars-foo", group_acronym_id=Group.objects.get(acronym="mars").pk, + submission_date=datetime.date.today(), revision="00", status_id=POSTED) IdSubmissionDetail.objects.create(filename="draft-ietf-mars-bar", group_acronym_id=Group.objects.get(acronym="mars").pk, + submission_date=datetime.date.today(), revision="00", status_id=INITIAL_VERSION_APPROVAL_REQUESTED) @@ -389,6 +391,7 @@ class ApprovalsTestCase(django.test.TestCase): self.assertEquals(len(q('.approvals a:contains("draft-ietf-mars-bar")')), 1) self.assertEquals(len(q('.preapprovals td:contains("draft-ietf-mars-foo")')), 0) self.assertEquals(len(q('.preapprovals td:contains("draft-ietf-mars-baz")')), 1) + self.assertEquals(len(q('.recently-approved a:contains("draft-ietf-mars-foo")')), 1) def test_add_preapproval(self): make_test_data() diff --git a/ietf/submit/utils.py b/ietf/submit/utils.py index 541752aca..f57f13a90 100644 --- a/ietf/submit/utils.py +++ b/ietf/submit/utils.py @@ -466,7 +466,7 @@ def get_approvable_submissions(user): if has_role(user, "Secretariat"): return res - # those we can reach as chairs + # those we can reach as chair return res.filter(group_acronym__role__name="chair", group_acronym__role__person__user=user) def get_preapprovals(user): @@ -484,7 +484,16 @@ def get_preapprovals(user): return res +def get_recently_approved(user, since): + if not user.is_authenticated(): + return [] + res = IdSubmissionDetail.objects.distinct().filter(status__in=[POSTED, POSTED_BY_SECRETARIAT], submission_date__gte=since, revision="00").order_by('-submission_date') + if has_role(user, "Secretariat"): + return res + + # those we can reach as chair + return res.filter(group_acronym__role__name="chair", group_acronym__role__person__user=user) class DraftValidation(object): diff --git a/ietf/submit/views.py b/ietf/submit/views.py index 7c864a9fc..c5659e2c9 100644 --- a/ietf/submit/views.py +++ b/ietf/submit/views.py @@ -261,10 +261,15 @@ def approvals(request): approvals = get_approvable_submissions(request.user) preapprovals = get_preapprovals(request.user) + days = 30 + recently_approved = get_recently_approved(request.user, datetime.date.today() - datetime.timedelta(days=days)) + return render_to_response('submit/approvals.html', {'selected': 'approvals', 'approvals': approvals, - 'preapprovals': preapprovals }, + 'preapprovals': preapprovals, + 'recently_approved': recently_approved, + 'days': days }, context_instance=RequestContext(request)) diff --git a/ietf/templates/submit/approvals.html b/ietf/templates/submit/approvals.html index c643f37ef..d4a1c6207 100644 --- a/ietf/templates/submit/approvals.html +++ b/ietf/templates/submit/approvals.html @@ -3,8 +3,8 @@ {% block morecss %} {{ block.super }} -table.approvals td, table.preapprovals td, -table.approvals th, table.preapprovals th { text-align: left; padding-right: 8px; padding-bottom: 4px; } +table.approvals td, table.preapprovals td, table.recently-approved td, +table.approvals th, table.preapprovals th, table.recently-approved th { text-align: left; padding-right: 8px; padding-bottom: 4px; } table.preapprovals tr td a.cancel { visibility: hidden; } table.preapprovals tr:hover { background-color: #eee; } @@ -34,7 +34,7 @@ table.preapprovals tr:hover td a.cancel { visibility: visible; } </table> {% endif %} -<h2 id="preapprovals">Pre-approved submissions not yet used</h2> +<h2 id="preapprovals">Pre-approved drafts not yet submitted</h2> {% if user|has_role:"Secretariat,WG Chair" %} <p>You can <a href="{% url submit_add_preapproval %}">add a pre-approval</a>.</p> @@ -61,4 +61,24 @@ table.preapprovals tr:hover td a.cancel { visibility: visible; } </table> {% endif %} +<h2 id="recently-approved">Approved drafts within the past {{ days }} days</h2> + +{% if not recently_approved %} +<p>No drafts approved.</p> +{% else %} + +<table cellspacing="0" class="recently-approved"> +<tr> + <th>Draft</th> + <th>Submitted</th> +</tr> +{% for d in recently_approved %} +<tr> + <td><a href="{% url doc_view d.filename %}">{{ d.filename }}</a></td> + <td>{{ d.submission_date }}</td> +</tr> +{% endfor %} +</table> +{% endif %} + {% endblock %}