|
2 | 2 | import os
|
3 | 3 | import time
|
4 | 4 | from copy import deepcopy
|
5 |
| -from urllib.parse import quote |
| 5 | +from urllib.parse import quote, urlencode, urljoin |
6 | 6 | from uuid import UUID, uuid4
|
7 | 7 |
|
8 | 8 | from django import forms as django_forms, http
|
|
72 | 72 | from olympia.reviewers.models import Whiteboard
|
73 | 73 | from olympia.reviewers.utils import ReviewHelper
|
74 | 74 | from olympia.users.models import (
|
75 |
| - DeveloperAgreementRestriction, |
76 | 75 | SuppressedEmailVerification,
|
77 | 76 | )
|
78 | 77 | from olympia.users.tasks import send_suppressed_email_confirmation
|
@@ -1952,26 +1951,38 @@ def request_review(request, addon_id, addon):
|
1952 | 1951 |
|
1953 | 1952 |
|
1954 | 1953 | def docs(request, doc_name=None):
|
| 1954 | + def get_url(base, doc_path=None): |
| 1955 | + base_url = urljoin(base, doc_path) |
| 1956 | + query = urlencode({'utm_referrer': 'amo'}) |
| 1957 | + return f'{base_url}?{query}' |
| 1958 | + |
| 1959 | + def mdn_url(doc_path): |
| 1960 | + return get_url(MDN_BASE, doc_path) |
| 1961 | + |
| 1962 | + def ext_url(doc_path): |
| 1963 | + return get_url(settings.EXTENSION_WORKSHOP_URL, doc_path) |
| 1964 | + |
1955 | 1965 | mdn_docs = {
|
1956 |
| - 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', |
| 1966 | + None: mdn_url(''), |
| 1967 | + 'getting-started': mdn_url(''), |
| 1968 | + 'reference': mdn_url(''), |
| 1969 | + 'how-to': mdn_url(''), |
| 1970 | + 'how-to/getting-started': mdn_url(''), |
| 1971 | + 'how-to/extension-development': mdn_url('#Extensions'), |
| 1972 | + 'how-to/other-addons': mdn_url('#Other_types_of_add-ons'), |
| 1973 | + 'how-to/thunderbird-mobile': mdn_url('#Application-specific'), |
| 1974 | + 'how-to/theme-development': mdn_url('#Themes'), |
| 1975 | + 'themes': mdn_url('/Themes/Background'), |
| 1976 | + 'themes/faq': mdn_url('/Themes/Background/FAQ'), |
| 1977 | + 'policies': ext_url('/documentation/publish/add-on-policies'), |
| 1978 | + 'policies/faq': ext_url('/documentation/publish/add-on-policies-faq'), |
| 1979 | + 'policies/agreement': ext_url( |
| 1980 | + '/documentation/publish/firefox-add-on-distribution-agreement' |
| 1981 | + ), |
1971 | 1982 | }
|
1972 | 1983 |
|
1973 | 1984 | if doc_name in mdn_docs:
|
1974 |
| - return redirect(MDN_BASE + mdn_docs[doc_name], permanent=True) |
| 1985 | + return redirect(mdn_docs[doc_name], permanent=True) |
1975 | 1986 |
|
1976 | 1987 | raise http.Http404()
|
1977 | 1988 |
|
@@ -2009,7 +2020,6 @@ def render_agreement(request, template, next_step, **extra_context):
|
2009 | 2020 | # potential errors highlighted)
|
2010 | 2021 | context = {
|
2011 | 2022 | 'agreement_form': form,
|
2012 |
| - 'agreement_message': str(DeveloperAgreementRestriction.error_message), |
2013 | 2023 | }
|
2014 | 2024 | context.update(extra_context)
|
2015 | 2025 | return TemplateResponse(request, template, context=context)
|
|
0 commit comments