Commit e4d9c30e authored by Cecylia Bocovich's avatar Cecylia Bocovich
Browse files

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
parent bd227cfc
......@@ -98,11 +98,22 @@ 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):
def build_help_body_message(self, locale_string):
body_msg = strings._("help_body_intro")
body_msg += strings._("help_body_paragraph")
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")
body_msg += "\twindows ar\n"
print(body_msg)
return body_msg
......@@ -176,8 +187,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,
......
......@@ -7,9 +7,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": "This is an automated email response from GetTor.\n\nGetTor 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 in Arabic your email content will look like:\n\n",
"help_subject": "[GetTor] Help Email",
"help_debug": "Log application errors to stdout",
"help_config": "Custom config file location (optional)",
......
......@@ -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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment