-
Notifications
You must be signed in to change notification settings - Fork 36
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
[WIP] Send an weekly email digest to users #121
base: master
Are you sure you want to change the base?
Conversation
The feature of listing the 5 latest timeline events to the digest depends on #117 |
applications/user.moon
Outdated
import Modules from require "models" | ||
|
||
weekly_favorites_followings_query = db.query "select object_id, count(*) from followings | ||
where object_type = 1 and created_at >= current_date - interval \'7\' day |
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.
the backslashes aren't necessary. If you don't need interplation (which you should generally avoid for queries), then I recommend using Lua's ``[[ and ]]` string delimiters
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.
Fixed.
-- render: true | ||
|
||
UserDigest = require "emails.user_digest" | ||
UserDigest\send @, @current_user.email, { |
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.
It's probably worth having a record of when the digest email is sent. Maybe a new model.
Additionally, it's probably not going to be sent by someone visiting a URL, so maybe the code to send the digest could be a method on the users model, or a separate flow.
(I'll add a cron job to send this out automatically later)
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.
I used the endpoint in a controller for testing purposes. I'll create a specific flow to be the mailer.
widgets/weekly_favorite_modules.moon
Outdated
@@ -0,0 +1,7 @@ | |||
class WeeklyFavoriteModules extends require "widgets.page" | |||
inner_content: => | |||
h2 "Hello #{@current_user\name_for_display!}, here is your weekly digest from LuaRocks, enjoy!" |
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.
It looks like this text is duplicated in the email template
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.
fixed
This is a WIP Pull Request, aiming to sends an weekly email to LuaRocks users with the latest things that happened in the website.