From db5cac403c21cc05fa2e34d69c75d1cef583766a Mon Sep 17 00:00:00 2001 From: cash Date: Tue, 1 Nov 2011 19:15:57 -0400 Subject: Fixes #4007 merged in sembrestels fix for ElggUser.isAdmin but used prototype instead of extending object in constructor --- js/classes/ElggUser.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'js/classes') diff --git a/js/classes/ElggUser.js b/js/classes/ElggUser.js index 8a7a8b7eb..b8a976fba 100644 --- a/js/classes/ElggUser.js +++ b/js/classes/ElggUser.js @@ -6,9 +6,23 @@ * @class Represents an ElggUser * @property {string} name * @property {string} username + * @property {string} language + * @property {boolean} admin */ elgg.ElggUser = function(o) { elgg.ElggEntity.call(this, o); }; -elgg.inherit(elgg.ElggUser, elgg.ElggEntity); \ No newline at end of file +elgg.inherit(elgg.ElggUser, elgg.ElggEntity); + +/** + * Is this user an admin? + * + * @warning The admin state of the user should be checked on the server for any + * actions taken that require admin privileges. + * + * @return {boolean} + */ +elgg.ElggUser.prototype.isAdmin = function() { + return this.admin; +}; \ No newline at end of file -- cgit v1.2.3 From 248f166dca51ea04e39560c19043a1c1a83d24d9 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 3 Nov 2011 20:14:47 -0400 Subject: Refs #4051 fixed insert for case when priority is set to 0 --- js/classes/ElggPriorityList.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'js/classes') diff --git a/js/classes/ElggPriorityList.js b/js/classes/ElggPriorityList.js index 831342f21..f7f91bb0f 100644 --- a/js/classes/ElggPriorityList.js +++ b/js/classes/ElggPriorityList.js @@ -16,7 +16,10 @@ elgg.ElggPriorityList = function() { * @return {Void} */ elgg.ElggPriorityList.prototype.insert = function(obj, opt_priority) { - var priority = parseInt(opt_priority || 500, 10); + var priority = 500; + if (arguments.length == 2) { + priority = parseInt(opt_priority, 10); + } priority = Math.max(priority, 0); @@ -31,7 +34,7 @@ elgg.ElggPriorityList.prototype.insert = function(obj, opt_priority) { /** * Iterates through each element in order. * -* Unlike every, this ignores the return value of the callback. + * Unlike every, this ignores the return value of the callback. * * @param {Function} callback The callback function to pass each element through. See * Array.prototype.every() for details. -- cgit v1.2.3 From 8f537ce0d21aa86fcb6a10e2fab4ac46fe1b473d Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 3 Nov 2011 20:27:23 -0400 Subject: Refs #4051 insert also needed to check for undefined priorities --- js/classes/ElggPriorityList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/classes') diff --git a/js/classes/ElggPriorityList.js b/js/classes/ElggPriorityList.js index f7f91bb0f..b4cec5044 100644 --- a/js/classes/ElggPriorityList.js +++ b/js/classes/ElggPriorityList.js @@ -17,7 +17,7 @@ elgg.ElggPriorityList = function() { */ elgg.ElggPriorityList.prototype.insert = function(obj, opt_priority) { var priority = 500; - if (arguments.length == 2) { + if (arguments.length == 2 && opt_priority != undefined) { priority = parseInt(opt_priority, 10); } -- cgit v1.2.3