bookmark for the post made

This commit is contained in:
Baris Usakli
2013-06-18 10:47:43 -04:00
parent b7e2bfff3d
commit 88a1fef941
3 changed files with 18 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ var utils = require('./../public/src/utils.js'),
bcrypt = require('bcrypt'),
marked = require('marked'),
notifications = require('./notifications.js'),
topics = require('./topics.js'),
async = require('async');
(function(User) {
@@ -465,10 +466,15 @@ var utils = require('./../public/src/utils.js'),
User.sendPostNotificationToFollowers = function(uid, tid, pid) {
User.getUserField(uid, 'username', function(username) {
User.getFollowers(uid, function(followers) {
var message = username + ' made a new post';
notifications.create(message, 5, 'topic/' + tid + '/' + pid, 'notification_'+new Date().getTime(), function(nid) {
notifications.push(nid, followers);
RDB.smembers('user:'+uid+':followers', function(err, followers) {
topics.getSlug(tid, function(slug) {
var message = username + ' made a new post';
notifications.create(message, 5, global.config.url + 'topic/' + slug + '#' + pid, 'notification_'+new Date().getTime(), function(nid) {
notifications.push(nid, followers);
});
});
});
});