Email notifications#801
Conversation
…scussion, studygroup
| email_notifications: { | ||
| initial: false, | ||
| reminder: false, | ||
| follow_up: false |
There was a problem hiding this comment.
Does this mean users of a group won't receive email alerts when a hangout in that group is created?
There was a problem hiding this comment.
No, These flags are there so cron job can keep track for which notification has been sent.
we makes it true once notification is sent. here
| // set intial flag for email_notifications true | ||
| listOfNewHangouts.forEach(function(hangout){ | ||
| Hangouts.update({_id:hangout._id}, {$set:{ | ||
| 'email_notifications.initial': true |
There was a problem hiding this comment.
.... oh wait, it's set to true here!
|
Looks beautiful. One bug I noticed: if you start a new discussion from the nav bar (instead of from inside a study group), the attempt fails because the discussion needs to be linked with a groupId. Maybe the form for a new discussion started on the nav header needs to be different -- or include the list of groups? Or perhaps we can remove the "Start a new discussion" button for now, and tell users to start new discussions from inside their groups. |
| @@ -0,0 +1,33 @@ | |||
| import { Meteor } from 'meteor/meteor'; | |||
| import {SSR} from 'meteor/meteorhacks:ssr'; | |||
| Email.send(mail); | ||
| } catch (e) { | ||
| console.log(e); | ||
|
|
| * @return { Array } members - list of group members | ||
| */ | ||
| function getGroupMembers(study_group_id) { | ||
| if (study_group_id === 'CB') { |
| * @name initialEmailNotificationsForHangouts | ||
| */ | ||
| async function initialEmailNotificationsForHangouts() { | ||
| let hangouts = await getNewHangouts(); |
There was a problem hiding this comment.
maybe this is worth wrapping in try catch.
There was a problem hiding this comment.
getNewHangouts doesn't throw any err, So I'm not sure what purpose would it serve.
In that case Discussion is linked to the
The idea behind this behaviour is that user can start a discussion without being a part of any group. same as a hangout. and yes we should include the list of groups. |
This PR is a part of an issue #626 and follows #776
Subscribers will be notified on following events
when user creates a hangout in a study group.
when new members joins the group.
when user creates a discussion in a study group.
User can set notification preference from their account settings.
A cron job riggers these notifications.
Right now cron triggers at every 40 minute but for production we might want to tune it up to 20!.