first pass at a custom title function (not ready for prod)

This commit is contained in:
Julian Lam
2013-07-24 15:19:26 -04:00
parent 1f8f61d1d8
commit d6938f4818
5 changed files with 60 additions and 25 deletions

View File

@@ -79,4 +79,18 @@ var utils = require('./../public/src/utils.js'),
// ...
}
}
Meta.build_title = function(title, current_user, callback) {
var user = require('./user');
if (!title) title = global.config.title || 'NodeBB';
else title += ' | ' + global.config.title || 'NodeBB';
// Grab the number of unread notifications
user.notifications.getUnreadCount(current_user, function(err, count) {
if (!err && count > 0) title = '(' + count + ') ' + title;
callback(err, title);
});
}
}(exports));