mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
closes #3120
also dont allow loading posts of a topic if its deleted via topics.loadMore
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
"no_posts_found": "No posts found!",
|
"no_posts_found": "No posts found!",
|
||||||
|
|
||||||
"post_is_deleted": "This post is deleted!",
|
"post_is_deleted": "This post is deleted!",
|
||||||
|
"topic_is_deleted": "This topic is deleted!",
|
||||||
|
|
||||||
"profile": "Profile",
|
"profile": "Profile",
|
||||||
"posted_by": "Posted by %1",
|
"posted_by": "Posted by %1",
|
||||||
|
|||||||
@@ -179,7 +179,6 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.usePagination) {
|
if (config.usePagination) {
|
||||||
|
|
||||||
var page = Math.max(1, Math.ceil(postIndex / config.postsPerPage));
|
var page = Math.max(1, Math.ceil(postIndex / config.postsPerPage));
|
||||||
|
|
||||||
if(parseInt(page, 10) !== pagination.currentPage) {
|
if(parseInt(page, 10) !== pagination.currentPage) {
|
||||||
|
|||||||
@@ -48,8 +48,12 @@ module.exports = function(Categories) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
var isAdminOrMod = results.isAdmin || results.isModerator;
|
var isAdminOrMod = results.isAdmin || results.isModerator;
|
||||||
results.topics = results.topics.filter(function(topic) {
|
results.topics.forEach(function(topic) {
|
||||||
return (!topic.deleted || isAdminOrMod || topic.isOwner);
|
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});
|
callback(null, {topics: results.topics, nextStart: data.stop + 1});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = function(Posts) {
|
|||||||
Posts.create = function(data, callback) {
|
Posts.create = function(data, callback) {
|
||||||
var uid = data.uid,
|
var uid = data.uid,
|
||||||
tid = data.tid,
|
tid = data.tid,
|
||||||
content = data.content,
|
content = data.content.toString(),
|
||||||
timestamp = data.timestamp || Date.now();
|
timestamp = data.timestamp || Date.now();
|
||||||
|
|
||||||
if (!uid && parseInt(uid, 10) !== 0) {
|
if (!uid && parseInt(uid, 10) !== 0) {
|
||||||
|
|||||||
@@ -448,13 +448,16 @@ SocketTopics.loadMore = function(socket, data, callback) {
|
|||||||
},
|
},
|
||||||
postCount: function(next) {
|
postCount: function(next) {
|
||||||
topics.getPostCount(data.tid, next);
|
topics.getPostCount(data.tid, next);
|
||||||
|
},
|
||||||
|
topic: function(next) {
|
||||||
|
topics.getTopicFields(data.tid, ['deleted'], next);
|
||||||
}
|
}
|
||||||
}, function(err, results) {
|
}, function(err, results) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(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]]'));
|
return callback(new Error('[[error:no-privileges]]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user