diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 2e2466bc6..ca4c43e4c 100644 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -272,6 +272,7 @@ class Globals(object): 'feedback_email', 'share_reply', 'nerds_email', + 'community_email', 'smtp_server', ], diff --git a/r2/r2/lib/emailer.py b/r2/r2/lib/emailer.py index d36653564..49ee4450e 100644 --- a/r2/r2/lib/emailer.py +++ b/r2/r2/lib/emailer.py @@ -56,6 +56,13 @@ def _fraud_email(body, kind): Email.handler.add_to_queue(None, g.fraud_email, g.domain, g.fraud_email, kind, body=body) +def _community_email(body, kind): + """ + For sending email to the community mailbox + """ + Email.handler.add_to_queue(c.user, g.community_email, g.domain, g.community_email, + kind, body=body) + def verify_email(user, dest=None): """ For verifying an email address @@ -119,6 +126,9 @@ def email_change_email(user): EmailChangeEmail(user=user).render(style='email'), Email.Kind.EMAIL_CHANGE) +def community_email(body, kind): + return _community_email(body, kind) + def nerds_email(body, from_name=g.domain): """Queues a feedback email to the nerds running this site.""" diff --git a/r2/r2/models/mail_queue.py b/r2/r2/models/mail_queue.py index d2ee8977d..ce774b434 100644 --- a/r2/r2/models/mail_queue.py +++ b/r2/r2/models/mail_queue.py @@ -308,6 +308,7 @@ class Email(object): "GOLD_GIFT_CODE", "SUSPICIOUS_PAYMENT", "FRAUD_ALERT", + "USER_FRAUD", ) # Do not remove anything from this dictionary! See above comment. @@ -334,7 +335,8 @@ class Email(object): Kind.VOID_PAYMENT: _("[reddit] your payment has been voided"), Kind.GOLD_GIFT_CODE: _("[reddit] your reddit gold gift code"), Kind.SUSPICIOUS_PAYMENT: _("[selfserve] suspicious payment alert"), - Kind.FRAUD_ALERT: _("[selfserve] fraud alert") + Kind.FRAUD_ALERT: _("[selfserve] fraud alert"), + Kind.USER_FRAUD: _("[selfserve] a user has committed fraud"), } def __init__(self, user, thing, email, from_name, date, ip,