From f831f882155adf4bdff3a94ccd88635d5de19bc5 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Fri, 4 Jan 2013 13:17:05 -0800 Subject: [PATCH] generateId -> mw.user.generateRandomSessionId As the existing comment block implies, generating random hashes for tagging users and sessions is generic and useful enough to merit exporting it out of closure scope. But 'user.generateId' would be confusing, so I renamed it to 'generateRandomSessionId' instead. Change-Id: I08f91a501c6883ab684b6864a93153b0e2dc34fc --- resources/mediawiki/mediawiki.user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/mediawiki/mediawiki.user.js b/resources/mediawiki/mediawiki.user.js index 5c5c87e295..3b2a59cdbc 100644 --- a/resources/mediawiki/mediawiki.user.js +++ b/resources/mediawiki/mediawiki.user.js @@ -61,7 +61,7 @@ * * @return String: Random set of 32 alpha-numeric characters */ - function generateId() { + this.generateRandomSessionId = function () { var i, r, id = '', seed = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; @@ -70,7 +70,7 @@ id += seed.substring( r, r + 1 ); } return id; - } + }; /** * Gets the current user's name. @@ -115,7 +115,7 @@ this.sessionId = function () { var sessionId = $.cookie( 'mediaWiki.user.sessionId' ); if ( typeof sessionId === 'undefined' || sessionId === null ) { - sessionId = generateId(); + sessionId = user.generateRandomSessionId(); $.cookie( 'mediaWiki.user.sessionId', sessionId, { 'expires': null, 'path': '/' } ); } return sessionId; @@ -138,7 +138,7 @@ } id = $.cookie( 'mediaWiki.user.id' ); if ( typeof id === 'undefined' || id === null ) { - id = generateId(); + id = user.generateRandomSessionId(); } // Set cookie if not set, or renew it if already set $.cookie( 'mediaWiki.user.id', id, { -- 2.20.1