mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
send notification to all followers when a user makes a post
This commit is contained in:
12
src/user.js
12
src/user.js
@@ -462,6 +462,18 @@ 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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
User.isFollowing = function(uid, theirid, callback) {
|
||||
RDB.sismember('user:'+uid+':following', theirid, function(err, data) {
|
||||
|
||||
Reference in New Issue
Block a user