From 7f6518e4a60797e2747ac0aaff520177e845ace4 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 8 Feb 2015 13:38:42 -0500 Subject: [PATCH] private plugin link fix --- public/src/client/account/header.js | 12 ++++++++---- src/middleware/middleware.js | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/public/src/client/account/header.js b/public/src/client/account/header.js index f0a0c112fa..6dcc0b27e4 100644 --- a/public/src/client/account/header.js +++ b/public/src/client/account/header.js @@ -1,3 +1,6 @@ +'use strict'; +/* globals define, app, ajaxify */ + define('forum/account/header', function() { var AccountHeader = {}; @@ -7,10 +10,11 @@ define('forum/account/header', function() { }; function displayAccountMenus() { - $('.account-sub-links .plugin-link').each(function() { - var $this = $(this); - $this.toggleClass('hide', $this.hasClass('private')); - }); + if (!app.user.uid || app.user.uid !== parseInt(ajaxify.variables.get('theirid'), 10)) { + $('.account-sub-links .plugin-link.private').each(function() { + $(this).addClass('hide'); + }); + } } function selectActivePill() { diff --git a/src/middleware/middleware.js b/src/middleware/middleware.js index 111b0b1ceb..f95c70e3ac 100644 --- a/src/middleware/middleware.js +++ b/src/middleware/middleware.js @@ -340,6 +340,7 @@ middleware.renderHeader = function(req, res, callback) { return; } results.user.isAdmin = results.isAdmin || false; + results.user.uid = parseInt(results.user.uid, 10); results.user['email:confirmed'] = parseInt(results.user['email:confirmed'], 10) === 1; templateValues.browserTitle = results.title;