Skip to content
Open
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
29 changes: 29 additions & 0 deletions src/review/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,35 @@ def check_for_potential_errors(self):
return potential_errors


class ReviewerNotificationForm(
core_forms.SettingEmailForm,
core_forms.ConfirmableIfErrorsForm,
):
QUESTION = _(
"The reviewer link in the email body appears to be missing or incorrect. Do you want to send it anyway?"
)

def __init__(self, *args, **kwargs):
self.expected_url = kwargs.pop("expected_url", None)
super().__init__(*args, **kwargs)

def check_for_potential_errors(self):
if not self.expected_url:
return []
body = self.cleaned_data.get("body", "")
if self.expected_url not in body:
return [
_(
"The email body does not contain the expected reviewer URL "
"(%(url)s), so the reviewer will not be able to complete the "
"request. This can happen if the body was copy-pasted into "
"the text box from elsewhere."
)
% {"url": self.expected_url}
]
return []


class GeneratedForm(forms.Form):
def __init__(self, *args, **kwargs):
review_assignment = kwargs.pop("review_assignment", None)
Expand Down
Loading
Loading