v1.18.x
barisusakli 9 years ago
parent b2552cb5e0
commit 825ecce0df

@ -1,6 +1,6 @@
'use strict'; 'use strict';
/* globals define, app, socket, utils */ /* globals define, app, socket, utils, ajaxify, config */
define('forum/recent', ['forum/infinitescroll', 'components'], function(infinitescroll, components) { define('forum/recent', ['forum/infinitescroll', 'components'], function(infinitescroll, components) {
var Recent = {}; var Recent = {};
@ -55,11 +55,15 @@ define('forum/recent', ['forum/infinitescroll', 'components'], function(infinite
Recent.updateAlertText(); Recent.updateAlertText();
} }
if (parseInt(data.topic.mainPid, 10) === parseInt(data.posts[0].pid, 10)) { var post = data.posts[0];
if (!post || !post.topic) {
return;
}
if (parseInt(post.topic.mainPid, 10) === parseInt(post.pid, 10)) {
return; return;
} }
if (ajaxify.data.selectedCategory && parseInt(ajaxify.data.selectedCategory.cid, 10) !== parseInt(data.topic.cid, 10)) { if (ajaxify.data.selectedCategory && parseInt(ajaxify.data.selectedCategory.cid, 10) !== parseInt(post.topic.cid, 10)) {
return; return;
} }
@ -68,7 +72,7 @@ define('forum/recent', ['forum/infinitescroll', 'components'], function(infinite
} }
if (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.url === 'unread/watched') { if (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.url === 'unread/watched') {
socket.emit('topics.isFollowed', data.topic.tid, function(err, isFollowed) { socket.emit('topics.isFollowed', post.tid, function(err, isFollowed) {
if (err) { if (err) {
app.alertError(err.message); app.alertError(err.message);
} }

@ -46,7 +46,7 @@ module.exports = function(SocketTopics) {
}; };
SocketTopics.markCategoryTopicsRead = function(socket, cid, callback) { SocketTopics.markCategoryTopicsRead = function(socket, cid, callback) {
topics.getUnreadTids(cid, socket.uid, function(err, tids) { topics.getUnreadTids(cid, socket.uid, '', function(err, tids) {
if (err) { if (err) {
return callback(err); return callback(err);
} }

@ -274,7 +274,7 @@ module.exports = function(Topics) {
posts.getUserInfoForPosts([postData.uid], uid, next); posts.getUserInfoForPosts([postData.uid], uid, next);
}, },
topicInfo: function(next) { topicInfo: function(next) {
Topics.getTopicFields(tid, ['tid', 'title', 'slug', 'cid', 'postcount'], next); Topics.getTopicFields(tid, ['tid', 'title', 'slug', 'cid', 'postcount', 'mainPid'], next);
}, },
parents: function(next) { parents: function(next) {
Topics.addParentPosts([postData], next); Topics.addParentPosts([postData], next);

Loading…
Cancel
Save