Skip to content

Commit 2a2fc4d

Browse files
committed
Refactor documentation links developer agreement form
Updated the documentation redirection logic in the `docs` view to use a new `developer_docs` dictionary. Modified the agreement template to include updated links for the Firefox Add-on Distribution Agreement, Review Policies, and FAQ. Adjusted test cases to reflect the removal of outdated documentation links. Update src/olympia/devhub/templates/devhub/includes/agreement.html Co-authored-by: Copilot <[email protected]> Update src/olympia/devhub/templates/devhub/includes/agreement.html Co-authored-by: Copilot <[email protected]> Fix test Fix lint complaint
1 parent df62af9 commit 2a2fc4d

File tree

4 files changed

+39
-27
lines changed

4 files changed

+39
-27
lines changed

src/olympia/devhub/templates/devhub/includes/agreement.html

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
<form method="post">
22
{% if not agreement_form.has_error('__all__') %}
33
<p>
4-
{{ agreement_message }}
4+
{{ _('Before starting, please read and accept our <a href="{agreement_url}" target="_blank" rel="noopener noreferrer">Firefox Add-on Distribution Agreement</a> as well as our <a href="{policies_url}" target="_blank" rel="noopener noreferrer">Review Policies and Rules</a>, and our <a href="{faq_url}" target="_blank" rel="noopener noreferrer">FAQ</a>. The Firefox Add-on Distribution Agreement also links to our Privacy Notice which explains how we handle your information.')|format_html(
5+
agreement_url=url('devhub.docs', 'policies/agreement'),
6+
policies_url=url('devhub.docs', 'policies'),
7+
faq_url=url('devhub.docs', 'policies/faq'),
8+
) }}
59
</p>
610
<ul class="agreement-links">
7-
<li>{{ agreement_form.distribution_agreement }}<a href="{{ url('devhub.docs', 'policies/agreement') }}" target="_blank" rel="noopener noreferrer">{{ _('Firefox Add-on Distribution Agreement') }}</a> {{ agreement_form.distribution_agreement.errors }}</li>
8-
<li>{{ agreement_form.review_policy }}<a href="{{ url('devhub.docs', 'policies/reviews') }}" target="_blank" rel="noopener noreferrer">{{ _('Review Policies and Rules') }}</a> {{ agreement_form.review_policy.errors }}</li>
11+
<li>
12+
<label for="{{ agreement_form.distribution_agreement.id_for_label }}">
13+
{{ agreement_form.distribution_agreement }}
14+
{{ _('Firefox Add-on Distribution Agreement') }}
15+
</label>
16+
{{ agreement_form.distribution_agreement.errors }}
17+
</li>
18+
<li>
19+
<label for="{{ agreement_form.review_policy.id_for_label }}">
20+
{{ agreement_form.review_policy }}
21+
{{ _('Review Policies and Rules') }}
22+
</label>
23+
{{ agreement_form.review_policy.errors }}
24+
</li>
925
</ul>
1026
<p>
1127
{{ _('I have read and accept this Agreement and the Rules and Policies') }}.

src/olympia/devhub/tests/test_views.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,11 +2055,8 @@ def test_doc_urls(self):
20552055
assert '/en-US/developers/docs/te/st', reverse('devhub.docs', args=['te/st'])
20562056

20572057
urls = [
2058-
(reverse('devhub.docs', args=['getting-started']), 301),
2059-
(reverse('devhub.docs', args=['how-to']), 301),
2060-
(reverse('devhub.docs', args=['how-to/other-addons']), 301),
2058+
(reverse('devhub.docs', args=['policies']), 301),
20612059
(reverse('devhub.docs', args=['fake-page']), 404),
2062-
(reverse('devhub.docs', args=['how-to/fake-page']), 404),
20632060
(reverse('devhub.docs'), 301),
20642061
]
20652062

src/olympia/devhub/tests/test_views_submit.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ def test_set_read_dev_agreement_error(self):
161161
}
162162
doc = pq(response.content)
163163
for id_ in form.errors.keys():
164-
selector = 'li input#id_%s + a + .errorlist' % id_
164+
selector = (
165+
'ul.agreement-links li label[for="id_%s"] + ul.errorlist li' % id_
166+
)
165167
assert doc(selector).text() == 'This field is required.'
166168

167169
def test_read_dev_agreement_skip(self):

src/olympia/devhub/views.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
from olympia.reviewers.models import Whiteboard
7373
from olympia.reviewers.utils import ReviewHelper
7474
from olympia.users.models import (
75-
DeveloperAgreementRestriction,
7675
SuppressedEmailVerification,
7776
)
7877
from olympia.users.tasks import send_suppressed_email_confirmation
@@ -1952,26 +1951,20 @@ def request_review(request, addon_id, addon):
19521951

19531952

19541953
def docs(request, doc_name=None):
1955-
mdn_docs = {
1954+
developer_docs = {
19561955
None: '',
1957-
'getting-started': '',
1958-
'reference': '',
1959-
'how-to': '',
1960-
'how-to/getting-started': '',
1961-
'how-to/extension-development': '#Extensions',
1962-
'how-to/other-addons': '#Other_types_of_add-ons',
1963-
'how-to/thunderbird-mobile': '#Application-specific',
1964-
'how-to/theme-development': '#Themes',
1965-
'themes': '/Themes/Background',
1966-
'themes/faq': '/Themes/Background/FAQ',
1967-
'policies': '/AMO/Policy',
1968-
'policies/reviews': '/AMO/Policy/Reviews',
1969-
'policies/contact': '/AMO/Policy/Contact',
1970-
'policies/agreement': '/AMO/Policy/Agreement',
1956+
'policies': '/documentation/publish/add-on-policies',
1957+
'policies/faq': '/documentation/publish/add-on-policies-faq',
1958+
'policies/agreement': (
1959+
'/documentation/publish/firefox-add-on-distribution-agreement'
1960+
),
19711961
}
19721962

1973-
if doc_name in mdn_docs:
1974-
return redirect(MDN_BASE + mdn_docs[doc_name], permanent=True)
1963+
if doc_name in developer_docs:
1964+
return redirect(
1965+
settings.EXTENSION_WORKSHOP_URL + developer_docs[doc_name],
1966+
permanent=True,
1967+
)
19751968

19761969
raise http.Http404()
19771970

@@ -2009,7 +2002,11 @@ def render_agreement(request, template, next_step, **extra_context):
20092002
# potential errors highlighted)
20102003
context = {
20112004
'agreement_form': form,
2012-
'agreement_message': str(DeveloperAgreementRestriction.error_message),
2005+
'agreement_link': absolutify(
2006+
reverse('devhub.docs', args=['policies/agreement'])
2007+
),
2008+
'policies_link': absolutify(reverse('devhub.docs', args=['policies'])),
2009+
'faq_link': absolutify(reverse('devhub.docs', args=['policies/faq'])),
20132010
}
20142011
context.update(extra_context)
20152012
return TemplateResponse(request, template, context=context)

0 commit comments

Comments
 (0)