also dont allow loading posts of a topic if its deleted via
topics.loadMore
v1.18.x
barisusakli 10 years ago
parent be1865da2d
commit b292aeea72

@ -7,6 +7,7 @@
"no_posts_found": "No posts found!",
"post_is_deleted": "This post is deleted!",
"topic_is_deleted": "This topic is deleted!",
"profile": "Profile",
"posted_by": "Posted by %1",

@ -179,7 +179,6 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com
}
if (config.usePagination) {
var page = Math.max(1, Math.ceil(postIndex / config.postsPerPage));
if(parseInt(page, 10) !== pagination.currentPage) {

@ -48,8 +48,12 @@ module.exports = function(Categories) {
return callback(err);
}
var isAdminOrMod = results.isAdmin || results.isModerator;
results.topics = results.topics.filter(function(topic) {
return (!topic.deleted || isAdminOrMod || topic.isOwner);
results.topics.forEach(function(topic) {
if (!(!topic.deleted || isAdminOrMod || topic.isOwner)) {
topic.title = '[[topic:topic_is_deleted]]';
topic.slug = topic.tid;
topic.teaser = null;
}
});
callback(null, {topics: results.topics, nextStart: data.stop + 1});

@ -14,7 +14,7 @@ module.exports = function(Posts) {
Posts.create = function(data, callback) {
var uid = data.uid,
tid = data.tid,
content = data.content,
content = data.content.toString(),
timestamp = data.timestamp || Date.now();
if (!uid && parseInt(uid, 10) !== 0) {

@ -448,13 +448,16 @@ SocketTopics.loadMore = function(socket, data, callback) {
},
postCount: function(next) {
topics.getPostCount(data.tid, next);
},
topic: function(next) {
topics.getTopicFields(data.tid, ['deleted'], next);
}
}, function(err, results) {
if (err) {
return callback(err);
}
if (!results.privileges.read) {
if (!results.privileges.read || (parseInt(results.topic.deleted, 10) && !results.privileges.view_deleted)) {
return callback(new Error('[[error:no-privileges]]'));
}

Loading…
Cancel
Save