|
|
|
@ -445,7 +445,8 @@ var async = require('async'),
|
|
|
|
|
|
|
|
|
|
function getTopics(set, uid, tids, callback) {
|
|
|
|
|
var returnTopics = {
|
|
|
|
|
'topics': []
|
|
|
|
|
topics: [],
|
|
|
|
|
nextStart: 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!tids || !tids.length) {
|
|
|
|
@ -571,18 +572,14 @@ var async = require('async'),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Topics.getUnreadTopics = function(uid, start, stop, callback) {
|
|
|
|
|
|
|
|
|
|
var unreadTopics = {
|
|
|
|
|
'show_markallread_button': 'show',
|
|
|
|
|
'no_topics_message': 'hidden',
|
|
|
|
|
'topics': []
|
|
|
|
|
no_topics_message: '',
|
|
|
|
|
show_markallread_button: 'hidden',
|
|
|
|
|
nextStart : 0,
|
|
|
|
|
topics: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function noUnreadTopics() {
|
|
|
|
|
unreadTopics.no_topics_message = '';
|
|
|
|
|
unreadTopics.show_markallread_button = 'hidden';
|
|
|
|
|
callback(null, unreadTopics);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sendUnreadTopics(topicIds) {
|
|
|
|
|
|
|
|
|
|
Topics.getTopicsByTids(topicIds, 0, uid, function(err, topicData) {
|
|
|
|
@ -597,13 +594,8 @@ var async = require('async'),
|
|
|
|
|
|
|
|
|
|
unreadTopics.topics = topicData;
|
|
|
|
|
unreadTopics.nextStart = parseInt(rank, 10) + 1;
|
|
|
|
|
|
|
|
|
|
if (!topicData || topicData.length === 0) {
|
|
|
|
|
unreadTopics.no_topics_message = '';
|
|
|
|
|
}
|
|
|
|
|
if (uid === 0 || topicData.length === 0) {
|
|
|
|
|
unreadTopics.show_markallread_button = 'hidden';
|
|
|
|
|
}
|
|
|
|
|
unreadTopics.no_topics_message = (!topicData || topicData.length === 0) ? '' : 'hidden';
|
|
|
|
|
unreadTopics.show_markallread_button = topicData.length === 0 ? 'hidden' : '';
|
|
|
|
|
|
|
|
|
|
callback(null, unreadTopics);
|
|
|
|
|
});
|
|
|
|
@ -618,7 +610,7 @@ var async = require('async'),
|
|
|
|
|
if (unreadTids.length) {
|
|
|
|
|
sendUnreadTopics(unreadTids);
|
|
|
|
|
} else {
|
|
|
|
|
noUnreadTopics();
|
|
|
|
|
callback(null, unreadTopics);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|