diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 7ad709958d..4f7aee5441 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -12,6 +12,7 @@ +
  • @@ -57,6 +58,7 @@ +
  • diff --git a/src/topics.js b/src/topics.js index 3819c86494..b88c800299 100644 --- a/src/topics.js +++ b/src/topics.js @@ -201,6 +201,12 @@ marked.setOptions({ }); } + Topics.getSlug = function(tid, callback) { + RDB.get('tid:' + tid + ':slug', function(err, slug) { + callback(slug); + }); + } + Topics.getTitleByPid = function(pid, callback) { RDB.get('pid:' + pid + ':tid', function(err, tid) { if (!err) { diff --git a/src/user.js b/src/user.js index f6cab56944..984a3fb0fc 100644 --- a/src/user.js +++ b/src/user.js @@ -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); + }); }); }); });