##// END OF EJS Templates
emails: ensure none empty emails are fetched from admin accounts in recipinets aren't specified....
marcink -
r2896:5e035500 default
parent child Browse files
Show More
@@ -32,7 +32,7 b' from rhodecode.lib.celerylib import get_'
32 from rhodecode.lib.hooks_base import log_create_repository
32 from rhodecode.lib.hooks_base import log_create_repository
33 from rhodecode.lib.rcmail.smtp_mailer import SmtpMailer
33 from rhodecode.lib.rcmail.smtp_mailer import SmtpMailer
34 from rhodecode.lib.utils2 import safe_int, str2bool
34 from rhodecode.lib.utils2 import safe_int, str2bool
35 from rhodecode.model.db import Session, IntegrityError, Repository, User
35 from rhodecode.model.db import Session, IntegrityError, Repository, User, true
36
36
37
37
38 @async_task(ignore_result=True, base=RequestContextTask)
38 @async_task(ignore_result=True, base=RequestContextTask)
@@ -52,9 +52,15 b' def send_email(recipients, subject, body'
52 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
52 subject = "%s %s" % (email_config.get('email_prefix', ''), subject)
53 if not recipients:
53 if not recipients:
54 # if recipients are not defined we send to email_config + all admins
54 # if recipients are not defined we send to email_config + all admins
55 admins = [
55 admins = []
56 u.email for u in User.query().filter(User.admin == True).all()]
56 for u in User.query().filter(User.admin == true()).all():
57 recipients = [email_config.get('email_to')] + admins
57 if u.email:
58 admins.append(u.email)
59 recipients = []
60 config_email = email_config.get('email_to')
61 if config_email:
62 recipients += [config_email]
63 recipients += admins
58
64
59 mail_server = email_config.get('smtp_server') or None
65 mail_server = email_config.get('smtp_server') or None
60 if mail_server is None:
66 if mail_server is None:
General Comments 0
You need to be logged in to leave comments. Login now