mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +01:00
closes #897
This commit is contained in:
@@ -263,23 +263,36 @@ var winston = require('winston'),
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadTools.notifyFollowers = function(tid, exceptUid) {
|
ThreadTools.notifyFollowers = function(tid, pid, exceptUid) {
|
||||||
async.parallel([
|
async.parallel([
|
||||||
function(next) {
|
function(next) {
|
||||||
topics.getTopicField(tid, 'title', function(err, title) {
|
topics.getTopicFields(tid, ['title', 'slug'], function(err, topicData) {
|
||||||
topics.getTeaser(tid, function(err, teaser) {
|
if(err) {
|
||||||
if (!err) {
|
return next(err);
|
||||||
notifications.create('<strong>' + teaser.username + '</strong> has posted a reply to: "<strong>' + title + '</strong>"', nconf.get('relative_path') + '/topic/' + tid, 'topic:' + tid, function(nid) {
|
}
|
||||||
next(null, nid);
|
|
||||||
});
|
user.getUserField(exceptUid, 'username', function(err, username) {
|
||||||
} else next(err);
|
if(err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
notifications.create('<strong>' + username + '</strong> has posted a reply to: "<strong>' + topicData.title + '</strong>"', nconf.get('relative_path') + '/topic/' + topicData.slug + '#' + pid, 'topic:' + tid, function(nid) {
|
||||||
|
next(null, nid);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
ThreadTools.getFollowers(tid, function(err, followers) {
|
ThreadTools.getFollowers(tid, function(err, followers) {
|
||||||
|
if(err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
exceptUid = parseInt(exceptUid, 10);
|
exceptUid = parseInt(exceptUid, 10);
|
||||||
if (followers.indexOf(exceptUid) !== -1) followers.splice(followers.indexOf(exceptUid), 1);
|
if (followers.indexOf(exceptUid) !== -1) {
|
||||||
|
followers.splice(followers.indexOf(exceptUid), 1);
|
||||||
|
}
|
||||||
|
|
||||||
next(null, followers);
|
next(null, followers);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ var async = require('async'),
|
|||||||
});
|
});
|
||||||
|
|
||||||
feed.updateRecent();
|
feed.updateRecent();
|
||||||
threadTools.notifyFollowers(tid, uid);
|
threadTools.notifyFollowers(tid, postData.pid, uid);
|
||||||
user.sendPostNotificationToFollowers(uid, tid, postData.pid);
|
user.sendPostNotificationToFollowers(uid, tid, postData.pid);
|
||||||
|
|
||||||
Topics.markCategoryUnreadForAll(tid, function(err) {
|
Topics.markCategoryUnreadForAll(tid, function(err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user