|
|
|
@ -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);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|