Add customizable invite-new-user text.

This makes life a lot easier for people inviting users to a new Zulip
organization, since they can give some form of context now.

Modified by tabbott to clean up CSS, backend code flow, and improve
the formatting of the emails.

Fixes: #1409.
This commit is contained in:
Ayush Jain
2017-02-13 01:51:31 +05:30
committed by Tim Abbott
parent cf96b1b873
commit 455c1919fc
11 changed files with 82 additions and 26 deletions

View File

@@ -201,6 +201,14 @@ def find_key_by_email(address):
if address in message.to:
return key_regex.search(message.body).groups()[0]
def find_pattern_in_email(address, pattern):
# type: (Text, Text) -> Text
from django.core.mail import outbox
key_regex = re.compile(pattern)
for message in reversed(outbox):
if address in message.to:
return key_regex.search(message.body).group(0)
def message_ids(result):
# type: (Dict[str, Any]) -> Set[int]
return set(message['id'] for message in result['messages'])