[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [gettor/master] Update GetTor help message



commit 7f1fd7e2c8ad5235af99ff3af9c5e5c94d16e5f8
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
Date:   Wed Mar 18 14:18:05 2020 -0400

    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
---
 gettor/services/email/sendmail.py | 22 +++++++++++++++++-----
 share/locale/en.json              |  9 ++++++---
 tests/test_email_service.py       |  8 ++++++--
 3 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/gettor/services/email/sendmail.py b/gettor/services/email/sendmail.py
index 754fb5b..07d343b 100644
--- a/gettor/services/email/sendmail.py
+++ b/gettor/services/email/sendmail.py
@@ -98,11 +98,21 @@ class Sendmail(object):
             requireTransportSecurity=True
         ).addCallback(self.sendmail_callback).addErrback(self.sendmail_errback)
 
-
-    def build_help_body_message(self):
-        body_msg = strings._("help_body_intro")
-        body_msg += strings._("help_body_paragraph")
+    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, 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,
diff --git a/share/locale/en.json b/share/locale/en.json
index dba3047..fd47984 100644
--- a/share/locale/en.json
+++ b/share/locale/en.json
@@ -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@xxxxxxxxxxxxxx\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)",
diff --git a/tests/test_email_service.py b/tests/test_email_service.py
index 4326b9c..5c0ddfb 100644
--- a/tests/test_email_service.py
+++ b/tests/test_email_service.py
@@ -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):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits