Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Revert "Email authors" link for an RFC to the draft that it came from #7077

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion ietf/doc/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2012-2023, All Rights Reserved
# Copyright The IETF Trust 2012-2024, All Rights Reserved
# -*- coding: utf-8 -*-


Expand Down Expand Up @@ -1513,6 +1513,25 @@ def test_draft_group_link(self):
self.assertEqual(r.status_code, 200)
self.assert_correct_non_wg_group_link(r, group)

def test_document_email_authors_button(self):
# rfc not from draft
rfc = WgRfcFactory()
DocEventFactory.create(doc=rfc, type='published_rfc')
url = urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=rfc.name))
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEqual(len(q('a:contains("Email authors")')), 0, 'Did not expect "Email authors" button')

# rfc from draft
draft = WgDraftFactory(group=rfc.group)
draft.relateddocument_set.create(relationship_id="became_rfc", target=rfc)
draft.set_state(State.objects.get(used=True, type="draft", slug="rfc"))
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEqual(len(q('a:contains("Email authors")')), 1, 'Expected "Email authors" button')

def test_document_primary_and_history_views(self):
IndividualDraftFactory(name='draft-imaginary-independent-submission')
ConflictReviewFactory(name='conflict-review-imaginary-irtf-submission')
Expand Down
6 changes: 5 additions & 1 deletion ietf/doc/views_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ def document_main(request, name, rev=None, document_html=False):
submission = group.acronym
submission = '<a href="%s">%s</a>' % (group.about_url(), submission)

draft = doc.came_from_draft()
mailto_name = draft.name if draft else None

return render(request, "doc/document_rfc.html" if document_html is False else "doc/document_html.html",
dict(doc=doc,
document_html=document_html,
Expand Down Expand Up @@ -356,7 +359,8 @@ def document_main(request, name, rev=None, document_html=False):
iana_experts_comment=iana_experts_comment,
presentations=presentations,
diff_revisions=diff_revisions,
submission=submission
submission=submission,
mailto_name=mailto_name,
))

elif doc.type_id == "draft":
Expand Down
16 changes: 9 additions & 7 deletions ietf/templates/doc/document_rfc.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "base.html" %}
{# Copyright The IETF Trust 2016-2023, All Rights Reserved #}
{# Copyright The IETF Trust 2016-2024, All Rights Reserved #}
{% load origin %}
{% load static %}
{% load ietf_filters %}
Expand Down Expand Up @@ -81,12 +81,14 @@
{% endif %}
</table>
<div class="buttonlist">
<a class="btn btn-primary btn-sm"
href="mailto:{{ doc.name }}@ietf.org?subject=Mail%20regarding%20{{ doc.name }}">
<i class="bi bi-envelope">
</i>
Email authors
</a>
{% if mailto_name %}
<a class="btn btn-primary btn-sm"
href="mailto:{{ mailto_name }}@ietf.org?subject=Mail%20regarding%20{{ doc.name }}">
<i class="bi bi-envelope">
</i>
Email authors
</a>
{% endif %}
{% if doc.group.type_id == "wg" or doc.group.type_id == "rg" %}
<a class="btn btn-primary btn-sm"
href="mailto:{{ doc.group.list_email }}?subject=Mail%20regarding%20{{ doc.name }}">
Expand Down
Loading