Skip to content

Commit 8a0723b

Browse files
committed
uplift: display link to help documentation in uplift request widget (Bug 2004078)
Display a link to the uplift request wiki page as a "help" button in the uplift request UI widget. To facilitate this, move the URL to a common location in `const.py` where it can be re-used. Pull request: #743
1 parent 3dc405d commit 8a0723b

File tree

6 files changed

+29
-9
lines changed

6 files changed

+29
-9
lines changed

src/lando/api/legacy/email.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from django.core.mail import EmailMessage
55

66
from lando.api.legacy.validation import REVISION_ID_RE
7+
from lando.utils.const import UPLIFT_DOCS_URL
78

89
logger = logging.getLogger(__name__)
910

@@ -49,28 +50,28 @@ def make_failure_email(
4950
return msg
5051

5152

52-
UPLIFT_FAILURE_EMAIL_TEMPLATE = """
53-
Your uplift request for {repo_name} did not complete successfully.
53+
UPLIFT_FAILURE_EMAIL_TEMPLATE = f"""
54+
Your uplift request for {{repo_name}} did not complete successfully.
5455
55-
See here for details and merge conflicts: {job_url}
56+
See here for details and merge conflicts: {{job_url}}
5657
5758
Reason:
58-
{reason}
59+
{{reason}}
5960
6061
Review the job details linked above for more information, including
6162
details of any merge conflicts that were encountered.
6263
6364
If your uplift failed due to merge conflicts, this means your patch
6465
cannot be uplifted without manually resolving the merge conflicts and
65-
re-submitting. Please pull the latest changes for {repo_name}, resolve
66+
re-submitting. Please pull the latest changes for {{repo_name}}, resolve
6667
the conflicts locally, and submit a new uplift request using `moz-phab
6768
uplift` once the conflicts are cleared.
6869
6970
Once you have created a new uplift Phabricator revision, you can use the
7071
"Link Existing Assessment" button to link your new uplift revision to the
7172
uplift assessment form you previously submitted.
7273
73-
See https://wiki.mozilla.org/index.php?title=Release_Management/Requesting_an_Uplift
74+
See {UPLIFT_DOCS_URL}
7475
for step-by-step instructions.
7576
""".strip()
7677

src/lando/api/tests/test_uplift_email.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
make_uplift_failure_email,
33
make_uplift_success_email,
44
)
5+
from lando.utils.const import UPLIFT_DOCS_URL
56

6-
FAILURE_EXPECTED_BODY = """
7+
FAILURE_EXPECTED_BODY = f"""
78
Your uplift request for firefox-beta did not complete successfully.
89
910
See here for details and merge conflicts: https://lando/jobs/1
@@ -24,7 +25,7 @@
2425
"Link Existing Assessment" button to link your new uplift revision to the
2526
uplift assessment form you previously submitted.
2627
27-
See https://wiki.mozilla.org/index.php?title=Release_Management/Requesting_an_Uplift
28+
See {UPLIFT_DOCS_URL}
2829
for step-by-step instructions.
2930
""".strip()
3031

src/lando/ui/jinja2/stack/partials/uplift-form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<a class="button"
3636
target="_blank"
3737
type="button"
38-
href="https://wiki.mozilla.org/index.php?title=Release_Management/Requesting_an_Uplift">
38+
href="{{ uplift.docs_url }}">
3939
<span class="icon">
4040
<i class="fa fa-question-circle"></i>
4141
</span>

src/lando/ui/jinja2/stack/partials/uplift-section.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ <h1>Uplifts</h1>
158158
<p class="is-size-7 has-text-grey">
159159
<time data-timestamp="{{ uplift_request.created_at }}"></time>, by {{ uplift_request.requested_by.email }}.
160160
</p>
161+
<div class="mt-1">
162+
<a class="button is-small is-light"
163+
target="_blank"
164+
href="{{ uplift.docs_url }}">
165+
<span class="icon is-small">
166+
<i class="fa fa-question-circle"></i>
167+
</span>
168+
<span>Help</span>
169+
</a>
170+
</div>
161171
</div>
162172
</div>
163173
</div>

src/lando/ui/uplift/context.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
UpliftAssessmentForm,
1616
UpliftRequestForm,
1717
)
18+
from lando.utils.const import UPLIFT_DOCS_URL
1819

1920

2021
@dataclass(frozen=True, slots=True)
@@ -28,6 +29,7 @@ class UpliftContext:
2829
assessment_link_form: LinkUpliftAssessmentForm | None
2930
can_create_uplift_submission: bool
3031
revision_id: int
32+
docs_url: str
3133

3234
@classmethod
3335
def build(
@@ -69,6 +71,7 @@ def build(
6971
assessment_link_form=assessment_link_form,
7072
can_create_uplift_submission=cls.can_create_submission(request),
7173
revision_id=revision_id,
74+
docs_url=UPLIFT_DOCS_URL,
7275
)
7376

7477
@staticmethod

src/lando/utils/const.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@
1414
"(?P<userinfo>[-A-Za-z0-9:._~%!$&'*()*+;=]*:[-A-Za-z0-9:._~%!$&'*()*+;=]*@)",
1515
flags=re.MULTILINE,
1616
)
17+
18+
# Uplift documentation URL.
19+
UPLIFT_DOCS_URL = (
20+
"https://wiki.mozilla.org/index.php?title=Release_Management/Requesting_an_Uplift"
21+
)

0 commit comments

Comments
 (0)