r78544 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78543‎ | r78544 | r78545 >
Date:19:18, 17 December 2010
Author:tparscal
Status:ok
Tags:
Comment:
Added anonymous function to mediaWiki.user
Modified paths:
  • /trunk/phase3/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -297,7 +297,7 @@
298298
299299 /* Public Methods */
300300
301 - /*
 301+ /**
302302 * Generates a random user session ID (32 alpha-numeric characters).
303303 *
304304 * This information would potentially be stored in a cookie to identify a user during a
@@ -315,7 +315,7 @@
316316 return id;
317317 }
318318
319 - /*
 319+ /**
320320 * Gets the current user's name.
321321 *
322322 * @return mixed user name string or null if users is anonymous
@@ -324,7 +324,16 @@
325325 return mediaWiki.config.get( 'wgUserName' );
326326 };
327327
328 - /*
 328+ /**
 329+ * Checks if the current user is anonymous.
 330+ *
 331+ * @return boolean
 332+ */
 333+ this.anonymous = function() {
 334+ return that.name() ? false : true;
 335+ };
 336+
 337+ /**
329338 * Gets a random session ID automatically generated and kept in a cookie.
330339 *
331340 * This ID is ephemeral for everyone, staying in their browser only until they close
@@ -346,7 +355,7 @@
347356 return sessionId;
348357 };
349358
350 - /*
 359+ /**
351360 * Gets the current user's name or a random ID automatically generated and kept in a cookie.
352361 *
353362 * This ID is persistent for anonymous users, staying in their browser up to 1 year. The

Follow-up revisions

RevisionCommit summaryAuthorDate
r79129MFT r78011 r78014 r78015 r78016 r78099 r78117 r78161 r78170 r78172 r78199 r78......platonides19:58, 28 December 2010
r830511.17wmf1: MFT r78544catrope21:51, 1 March 2011

Status & tagging log