first pass #1720, updating existing calls to notifications.create, backwards compatibility in case plugins create notifications too.

This commit is contained in:
Julian Lam
2014-06-20 16:54:34 -04:00
parent 454c05c391
commit d257632878
6 changed files with 53 additions and 31 deletions

View File

@@ -153,22 +153,20 @@ var async = require('async'),
}
async.parallel({
username: function(next) {
user.getUserField(uid, 'username', next);
},
slug: function(next) {
topics.getTopicField(tid, 'slug', next);
},
postIndex: function(next) {
posts.getPidIndex(pid, next);
}
username: async.apply(user.getUserField, uid, 'username'),
slug: async.apply(topics.getTopicField, tid, 'slug'),
postIndex: async.apply(posts.getPidIndex, pid),
postContent: async.apply(posts.getPostField, pid, 'content')
}, function(err, results) {
if (err) {
return;
}
notifications.create({
text: '[[notifications:user_made_post, ' + results.username + ']]',
body: {
short: '[[notifications:user_made_post, ' + results.username + ']]',
long: results.postContent
},
path: nconf.get('relative_path') + '/topic/' + results.slug + '/' + results.postIndex,
uniqueId: 'topic:' + tid,
from: uid