mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
removed notification count in title, removed api calls to it (left method intact) so hopefully title building is faster too. closes #625
This commit is contained in:
18
src/meta.js
18
src/meta.js
@@ -144,27 +144,19 @@ var fs = require('fs'),
|
|||||||
};
|
};
|
||||||
|
|
||||||
Meta.title = {
|
Meta.title = {
|
||||||
build: function (urlFragment, current_user, callback) {
|
build: function (urlFragment, callback) {
|
||||||
var self = this,
|
var user = require('./user');
|
||||||
user = require('./user');
|
|
||||||
|
|
||||||
async.parallel({
|
Meta.title.parseFragment(urlFragment, function(err, title) {
|
||||||
title: function (next) {
|
|
||||||
self.parseFragment(urlFragment, next);
|
|
||||||
},
|
|
||||||
notifCount: function (next) {
|
|
||||||
user.notifications.getUnreadCount(current_user, next);
|
|
||||||
}
|
|
||||||
}, function (err, values) {
|
|
||||||
var title;
|
var title;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
title = Meta.config.title || 'NodeBB';
|
title = Meta.config.title || 'NodeBB';
|
||||||
} else {
|
} else {
|
||||||
title = (values.title ? values.title + ' | ' : '') + (Meta.config.title || 'NodeBB');
|
title = (title ? title + ' | ' : '') + (Meta.config.title || 'NodeBB');
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(null, title, values.notifCount);
|
callback(null, title);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
parseFragment: function (urlFragment, callback) {
|
parseFragment: function (urlFragment, callback) {
|
||||||
|
|||||||
@@ -1084,8 +1084,8 @@ websockets.init = function(io) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('api:meta.buildTitle', function(text, callback) {
|
socket.on('api:meta.buildTitle', function(text, callback) {
|
||||||
meta.title.build(text, uid, function(err, title, numNotifications) {
|
meta.title.build(text, function(err, title) {
|
||||||
callback(title, numNotifications);
|
callback(title);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user