-
Notifications
You must be signed in to change notification settings - Fork 34
feat: Notifications mailing system #327
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
1ce98cd
1e9e28c
d3f23df
91b4a0e
4c475e1
c7d1fb6
b741e53
3274ef7
9e7dead
48d4811
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,6 +255,18 @@ def _add_uuid_to_users_table(table: Model, _column: Field) -> None: | |
user.save() | ||
|
||
|
||
def _add_mail_subscription_to_users_table( | ||
table: Model, _column: Field, | ||
) -> None: | ||
log.info( | ||
'Adding mail subscription for users, might take some extra time...', | ||
) | ||
with db_config.database.transaction(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And if its default true, are you sure you need this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to migrate it on my environment and it created the column with null for all the objects |
||
for user in table: | ||
user.mail_subscription = True | ||
user.save() | ||
|
||
|
||
def _api_keys_migration() -> bool: | ||
User = models.User | ||
_add_not_null_column(User, User.api_key, _add_api_keys_to_users_table) | ||
|
@@ -309,6 +321,13 @@ def _uuid_migration() -> bool: | |
return True | ||
|
||
|
||
def _mail_subscription() -> bool: | ||
User = models.User | ||
_add_not_null_column( | ||
User, User.mail_subscription, _add_mail_subscription_to_users_table, | ||
) | ||
|
||
|
||
def _assessment_migration() -> bool: | ||
Solution = models.Solution | ||
_add_not_null_column(Solution, Solution.assessment) | ||
|
@@ -328,6 +347,7 @@ def main(): | |
_api_keys_migration() | ||
_last_course_viewed_migration() | ||
_uuid_migration() | ||
_mail_subscription() | ||
|
||
if models.database.table_exists(models.UserCourse.__name__.lower()): | ||
_add_user_course_constaint() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import typing | ||
|
||
from flask import Flask | ||
from flask_apscheduler import APScheduler # type: ignore | ||
from flask_babel import Babel # type: ignore | ||
from flask_httpauth import HTTPBasicAuth | ||
from flask_limiter import Limiter # type: ignore | ||
|
@@ -48,6 +49,9 @@ | |
|
||
webmail = Mail(webapp) | ||
|
||
webscheduler = APScheduler(app=webapp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this scheduler is part of lmsweb? is it running under the WSGI app? |
||
webscheduler.start() | ||
|
||
|
||
# Must import files after app's creation | ||
from lms.lmsdb import models # NOQA: F401, E402, I202 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from lms.utils.config import celery | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You put this both in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to have some help there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gal432 , can you give a hand? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I understand why did you do that... |
||
|
||
celery_app = celery.app | ||
|
||
__all__ = ('celery_app',) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from lms.utils.config import celery | ||
|
||
celery_app = celery.app | ||
|
||
__all__ = ('celery_app',) |
Uh oh!
There was an error while loading. Please reload this page.