From 49f86295663fbc648054bbde3a8e41177f4ffbb8 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 10 Oct 2014 13:14:33 -0400 Subject: [PATCH 1/2] Make the default mail sender use the Flask mail config value --- config.py | 2 +- util/useremails.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/config.py b/config.py index 6742d1a43..8b1c9fd8c 100644 --- a/config.py +++ b/config.py @@ -55,7 +55,7 @@ class DefaultConfig(object): MAIL_PORT = 587 MAIL_USERNAME = '' MAIL_PASSWORD = '' - DEFAULT_MAIL_SENDER = '' + MAIL_DEFAULT_SENDER = 'support@quay.io' MAIL_FAIL_SILENTLY = False TESTING = True diff --git a/util/useremails.py b/util/useremails.py index ca0fd896a..52e064ea1 100644 --- a/util/useremails.py +++ b/util/useremails.py @@ -75,7 +75,7 @@ def send_email(recipient, subject, template_file, parameters): rendered_html = template_env.get_template(template_file + '.html').render(parameters) - msg = Message('[%s] %s' % (app_title, subject), sender='support@quay.io', recipients=[recipient]) + msg = Message('[%s] %s' % (app_title, subject), recipients=[recipient]) msg.html = rendered_html mail.send(msg) @@ -135,9 +135,7 @@ def send_org_invite_email(member_name, member_email, orgname, team, adder, code) def send_invoice_email(email, contents): # Note: This completely generates the contents of the email, so we don't use the # normal template here. - msg = Message('Quay.io payment received - Thank you!', - sender='support@quay.io', - recipients=[email]) + msg = Message('Quay.io payment received - Thank you!', recipients=[email]) msg.html = contents mail.send(msg) @@ -154,7 +152,7 @@ def send_subscription_change(change_description, customer_id, customer_email, qu """ title = SUBSCRIPTION_CHANGE_TITLE.format(quay_username, change_description) - msg = Message(title, sender='support@quay.io', recipients=['stripe@quay.io']) + msg = Message(title, recipients=['stripe@quay.io']) msg.html = SUBSCRIPTION_CHANGE.format(change_description, customer_id, customer_email, quay_username) mail.send(msg) From 37aa70c28e6f8ba4b9eda584fb68ca1e3646b3b7 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 10 Oct 2014 19:05:20 -0400 Subject: [PATCH 2/2] Notifications must check for the user OR an organization with the namespace name --- endpoints/notificationmethod.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/endpoints/notificationmethod.py b/endpoints/notificationmethod.py index 589ebd06d..78104ea2e 100644 --- a/endpoints/notificationmethod.py +++ b/endpoints/notificationmethod.py @@ -211,7 +211,7 @@ class FlowdockMethod(NotificationMethod): if not token: return - owner = model.get_user(notification.repository.namespace_user.username) + owner = model.get_user_or_org(notification.repository.namespace_user.username) if not owner: # Something went wrong. return @@ -267,7 +267,7 @@ class HipchatMethod(NotificationMethod): if not token or not room_id: return - owner = model.get_user(notification.repository.namespace_user.username) + owner = model.get_user_or_org(notification.repository.namespace_user.username) if not owner: # Something went wrong. return @@ -334,7 +334,7 @@ class SlackMethod(NotificationMethod): if not token or not subdomain: return - owner = model.get_user(notification.repository.namespace_user.username) + owner = model.get_user_or_org(notification.repository.namespace_user.username) if not owner: # Something went wrong. return