Skip to content

Commit 5eca8e8

Browse files
committed
Add community_email method
1 parent 705b49f commit 5eca8e8

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

r2/r2/lib/app_globals.py

+1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ class Globals(object):
272272
'feedback_email',
273273
'share_reply',
274274
'nerds_email',
275+
'community_email',
275276
'smtp_server',
276277
],
277278

r2/r2/lib/emailer.py

+10
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ def _fraud_email(body, kind):
5656
Email.handler.add_to_queue(None, g.fraud_email, g.domain, g.fraud_email,
5757
kind, body=body)
5858

59+
def _community_email(body, kind):
60+
"""
61+
For sending email to the community mailbox
62+
"""
63+
Email.handler.add_to_queue(c.user, g.community_email, g.domain, g.community_email,
64+
kind, body=body)
65+
5966
def verify_email(user, dest=None):
6067
"""
6168
For verifying an email address
@@ -119,6 +126,9 @@ def email_change_email(user):
119126
EmailChangeEmail(user=user).render(style='email'),
120127
Email.Kind.EMAIL_CHANGE)
121128

129+
def community_email(body, kind):
130+
return _community_email(body, kind)
131+
122132

123133
def nerds_email(body, from_name=g.domain):
124134
"""Queues a feedback email to the nerds running this site."""

r2/r2/models/mail_queue.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ class Email(object):
308308
"GOLD_GIFT_CODE",
309309
"SUSPICIOUS_PAYMENT",
310310
"FRAUD_ALERT",
311+
"USER_FRAUD",
311312
)
312313

313314
# Do not remove anything from this dictionary! See above comment.
@@ -334,7 +335,8 @@ class Email(object):
334335
Kind.VOID_PAYMENT: _("[reddit] your payment has been voided"),
335336
Kind.GOLD_GIFT_CODE: _("[reddit] your reddit gold gift code"),
336337
Kind.SUSPICIOUS_PAYMENT: _("[selfserve] suspicious payment alert"),
337-
Kind.FRAUD_ALERT: _("[selfserve] fraud alert")
338+
Kind.FRAUD_ALERT: _("[selfserve] fraud alert"),
339+
Kind.USER_FRAUD: _("[selfserve] a user has committed fraud"),
338340
}
339341

340342
def __init__(self, user, thing, email, from_name, date, ip,

0 commit comments

Comments
 (0)