Created
July 8, 2016 10:16
-
-
Save weepy/a2f53fd7be36235ee50f264d22bef75c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createNotifications() { | |
var activities = Activity.findAll({notified: false}) | |
var notifications = activities.map(createNotifications) | |
notifications = flatten(notifications) | |
// later => notifications = simplify(notifications) | |
sendBulk(notifications, function() { | |
notifications.forEach((notification) => { | |
notification.set({notifed: true}) | |
}) | |
}) | |
} | |
function createNotifications(activity) { | |
user = User.find(activity.userId) | |
return user.followers.map( id { | |
return new Notification(activity.type, activity, user.messagingId ) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment