v1.18.x
barisusakli 11 years ago
parent fa1275c03a
commit b8b482e287

@ -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);

@ -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]]'));
}

@ -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;

@ -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
});
});
};

@ -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
});
});
};

@ -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
});
});
});

@ -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({

@ -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]]';
}
}

Loading…
Cancel
Save