Update GetTor help message

This restructures the GetTor help message. The message now includes:
- instructions to reply to the message for links
- available locales
- a valid example links request
This commit is contained in:
Cecylia Bocovich 2020-03-18 14:18:05 -04:00
parent bd227cfc75
commit 7f1fd7e2c8
3 changed files with 28 additions and 9 deletions

View File

@ -98,11 +98,21 @@ class Sendmail(object):
requireTransportSecurity=True
).addCallback(self.sendmail_callback).addErrback(self.sendmail_errback)
def build_locale_string(self, locales):
locale_string = ""
for locale in locales:
locale_string += "\t" + locale[0] + "\n"
return locale_string
def build_help_body_message(self):
body_msg = strings._("help_body_intro")
body_msg += strings._("help_body_paragraph")
def build_help_body_message(self, locale_string):
body_msg = strings._("body_intro")
body_msg += strings._("help_body_intro")
body_msg += strings._("help_body_support")
body_msg += "\twindows\n\tlinux\n\tosx\n\n"
body_msg += strings._("help_body_respond")
body_msg += strings._("help_body_locale")
body_msg += locale_string + "\n"
body_msg += strings._("help_body_example").format("Windows", "Arabic", "windows ar")
return body_msg
@ -176,8 +186,10 @@ class Sendmail(object):
hid.hexdigest()
)
)
locales = yield self.conn.get_locales()
locale_string = self.build_locale_string(locales)
body_msg = self.build_help_body_message()
body_msg = self.build_help_body_message(locale_string)
yield self.sendmail(
email_addr=id,

View File

@ -1,4 +1,5 @@
{
"body_intro": "This is an automated email response from GetTor.\n\n",
"links_body_platform": "You requested Tor Browser for {}.\n\n",
"links_body_links": "You will need only one of the links below to download the bundle. If a link does not work for you, try the next one.\n\n{}\n\n",
"links_body_archive": "Should you have issues with any of the links above you can access the following archives:\n\n",
@ -7,9 +8,11 @@
"links_body_download_filename": "Download the file: {}\n\n",
"links_body_ending": "\n--\nGetTor",
"links_subject": "[GetTor] Links for your request",
"help_body_intro": "This is how you can request a tor browser bundle link.\n\n",
"help_body_paragraph": "Send an email to: gettor@torproject.org\n\nIn the body of the email only write: <operating system> <language>.\n\n",
"help_body_support": "We only support windows, osx and linux as operating systems.\n\n",
"help_body_intro": "GetTor can send you download links for Tor Browser.\n",
"help_body_support": "Simply reply to this email and write the operating system you want to install Tor Browser on in your response. We support the following operating systems:\n\n",
"help_body_respond": "GetTor will then respond with download instructions.\n\n",
"help_body_locale": "If you want Tor Browser in a language other than English, mention one of the following language codes in your response:\n\n",
"help_body_example": "For example, if you want Tor Browser for {} in {} your email content will look like:\n\n\t{}\n\n",
"help_subject": "[GetTor] Help Email",
"help_debug": "Log application errors to stdout",
"help_config": "Custom config file location (optional)",

View File

@ -198,10 +198,14 @@ class EmailServiceTests(unittest.TestCase):
body_msg = ep.build_body_message(link_msg, "osx", file)
assert "You requested Tor Browser for osx" in body_msg
@pytest_twisted.inlineCallbacks
def test_help_body_message(self):
ep = self.sm_client
help_msg = ep.build_help_body_message()
assert "This is how you can request a tor browser bundle link" in help_msg
locales = yield ep.conn.get_locales()
locale_string = ep.build_locale_string(locales)
help_msg = ep.build_help_body_message(locale_string)
assert "This is an automated email response from GetTor." in help_msg
assert "\twindows\n\tlinux\n\tosx\n" in help_msg
@pytest_twisted.inlineCallbacks
def test_get_locales(self):