New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #723 : Greeting mail on user registration #724
Conversation
backend/blueprint/api/models/user.py
Outdated
@@ -28,3 +28,14 @@ def save_to_db(self): | |||
@classmethod | |||
def getUser(cls, username): | |||
return cls.query.filter_by(username=username).first() | |||
|
|||
@db.event.listens_for(User, "after_insert") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
Codecov Report
@@ Coverage Diff @@
## development #724 +/- ##
==========================================
Coverage 100% 100%
==========================================
Files 1 1
Lines 43 43
==========================================
Hits 43 43 Continue to review full report at Codecov.
|
backend/blueprint/api/models/user.py
Outdated
msg['body'] = "It's good to have you onboard with Badgeyay. Welcome to " \ | ||
"FOSSASIA Family." | ||
res = send_mail(msg) | ||
print(res) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good, just see to the camelCase
changes I've suggested
backend/blueprint/api/utils/mail.py
Outdated
@@ -1,17 +1,11 @@ | |||
from flask_mail import Mail, Message | |||
from flask import current_app as app | |||
from flask import jsonify | |||
from models.user import User | |||
from .response import Response | |||
|
|||
|
|||
def send_mail(message): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about using camelCase
and set the name to sendMail
?
backend/blueprint/api/models/user.py
Outdated
|
||
|
||
@db.event.listens_for(User, "after_insert") | ||
def send_verification(mapper, connection, target): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCase
here as well, maybe?
backend/blueprint/api/models/user.py
Outdated
msg['receipent'] = sav_user.username | ||
msg['body'] = "It's good to have you onboard with Badgeyay. Welcome to " \ | ||
"FOSSASIA Family." | ||
res = sendMail(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local variable 'res' is assigned to but never used
Done @gabru-md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯
backend/blueprint/api/models/user.py
Outdated
|
||
@db.event.listens_for(User, "after_insert") | ||
def sendVerification(mapper, connection, target): | ||
sav_user = target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not using target directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, please view my comment inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍
Fixes : #723
Checklist
development
branch.Preview Link
Changes proposed in this pull request: