fix: Revert "Email authors" link for an RFC to the draft that it came from (#7077)
* fix: Revert "Email authors" link for RFCs to the draft that it came from (#6856) * refactor: Move mailto_name calculation to the view * fix: Fully revert document_draft.html
This commit is contained in:
parent
229fb89420
commit
ce1571ee68
|
@ -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 -*-
|
||||
|
||||
|
||||
|
@ -1513,6 +1513,25 @@ Man Expires September 22, 2015 [Page 3]
|
|||
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')
|
||||
|
|
|
@ -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,
|
||||
|
@ -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":
|
||||
|
|
|
@ -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 %}
|
||||
|
@ -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 }}">
|
||||
|
|
Loading…
Reference in a new issue