From b8b482e2876df2d16678de6391a58dd93596bc94 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 22 May 2014 14:56:15 -0400 Subject: [PATCH] closes #1555 --- public/src/forum/topic.js | 4 ++-- src/controllers/categories.js | 2 +- src/controllers/topics.js | 4 ++-- src/privileges/categories.js | 10 ++++------ src/privileges/posts.js | 8 +++----- src/privileges/topics.js | 10 ++++------ src/topics.js | 2 +- src/topics/posts.js | 6 +++--- 8 files changed, 20 insertions(+), 26 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 86e0b4c8ac..309acb2066 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -351,8 +351,8 @@ define(['forum/pagination', 'forum/infinitescroll', 'forum/topic/threadTools', ' } function toggleModTools(postHtml, privileges) { - postHtml.find('.edit, .delete').toggleClass('none', !privileges.meta.editable); - postHtml.find('.move').toggleClass('none', !privileges.meta.move); + postHtml.find('.edit, .delete').toggleClass('none', !privileges.editable); + postHtml.find('.move').toggleClass('none', !privileges.move); postHtml.find('.reply, .quote').toggleClass('none', !$('.post_reply').length); var isSelfPost = parseInt(postHtml.attr('data-uid'), 10) === parseInt(app.uid, 10); postHtml.find('.chat, .flag').toggleClass('none', isSelfPost); diff --git a/src/controllers/categories.js b/src/controllers/categories.js index 8b813eb95f..c51cc33b4c 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -77,7 +77,7 @@ categoriesController.get = function(req, res, next) { return next(err); } - if (!categoryPrivileges.meta.read) { + if (!categoryPrivileges.read) { return next(new Error('[[error:no-privileges]]')); } diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 19980dfdc1..1ddae407ae 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -26,7 +26,7 @@ topicsController.get = function(req, res, next) { return next(err); } - if (!privileges.meta.read) { + if (!privileges.read) { return next(new Error('[[error:no-privileges]]')); } @@ -45,7 +45,7 @@ topicsController.get = function(req, res, next) { topics.getTopicWithPosts(tid, uid, start, end, function (err, topicData) { if (topicData) { - if (parseInt(topicData.deleted, 10) === 1 && !userPrivileges.meta.view_deleted) { + if (parseInt(topicData.deleted, 10) === 1 && !userPrivileges.view_deleted) { return next(new Error('[[error:no-topic]]')); } topicData.currentPage = page; diff --git a/src/privileges/categories.js b/src/privileges/categories.js index 8de9702958..7509808f60 100644 --- a/src/privileges/categories.js +++ b/src/privileges/categories.js @@ -34,12 +34,10 @@ module.exports = function(privileges) { var editable = results.isAdministrator || results.isModerator; callback(null, { - meta: { - 'topics:create': results['topics:create'], - editable: editable, - view_deleted: editable, - read: results.read - } + 'topics:create': results['topics:create'], + editable: editable, + view_deleted: editable, + read: results.read }); }); }; diff --git a/src/privileges/posts.js b/src/privileges/posts.js index bd580d0144..81539419f7 100644 --- a/src/privileges/posts.js +++ b/src/privileges/posts.js @@ -44,11 +44,9 @@ module.exports = function(privileges) { var editable = results.isAdministrator || results.isModerator || results.manage_content || results.manage_topic || results.isOwner; callback(null, { - meta: { - editable: editable, - view_deleted: editable, - move: results.isAdministrator || results.isModerator - } + editable: editable, + view_deleted: editable, + move: results.isAdministrator || results.isModerator }); }); }; diff --git a/src/privileges/topics.js b/src/privileges/topics.js index 8b36bd6c49..5dd7bedc92 100644 --- a/src/privileges/topics.js +++ b/src/privileges/topics.js @@ -44,12 +44,10 @@ module.exports = function(privileges) { var editable = results.isAdministrator || results.isModerator || results.manage_topic; callback(null, { - meta: { - 'topics:reply': results['topics:reply'], - editable: editable, - view_deleted: editable, - read: results.read - } + 'topics:reply': results['topics:reply'], + editable: editable, + view_deleted: editable, + read: results.read }); }); }); diff --git a/src/topics.js b/src/topics.js index 2472dd3219..76b01ae036 100644 --- a/src/topics.js +++ b/src/topics.js @@ -184,7 +184,7 @@ var async = require('async'), function isTopicVisible(topicData, topicInfo) { var deleted = parseInt(topicData.deleted, 10) !== 0; - return !deleted || (deleted && topicInfo.privileges.meta.view_deleted) || parseInt(topicData.uid, 10) === parseInt(uid, 10); + return !deleted || (deleted && topicInfo.privileges.view_deleted) || parseInt(topicData.uid, 10) === parseInt(uid, 10); } async.parallel({ diff --git a/src/topics/posts.js b/src/topics/posts.js index b531631b6a..d836fc7536 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -64,11 +64,11 @@ module.exports = function(Topics) { postData[i].upvoted = results.voteData[i].upvoted; postData[i].downvoted = results.voteData[i].downvoted; postData[i].votes = postData[i].votes || 0; - postData[i].display_moderator_tools = results.privileges[i].meta.editable; - postData[i].display_move_tools = results.privileges[i].meta.move; + postData[i].display_moderator_tools = results.privileges[i].editable; + postData[i].display_move_tools = results.privileges[i].move; postData[i].selfPost = parseInt(uid, 10) === parseInt(postData[i].uid, 10); - if(postData[i].deleted && !results.privileges[i].meta.view_deleted) { + if(postData[i].deleted && !results.privileges[i].view_deleted) { postData[i].content = '[[topic:post_is_deleted]]'; } }