https://bugzilla.wikimedia.org/show_bug.cgi?id=36138

       Web browser: ---
             Bug #: 36138
           Summary: mw.user.bucket does not re-bucket when a cookie is
                    present and the version number has increased
           Product: MediaWiki
           Version: 1.19
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: JavaScript
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---


After updating the bucketing configuration (and bumping up the version number),
users are not re-bucketed.

REPRODUCE:

Assuming a config like so:

array(
    'buckets' => array(
        'zero' => 50,
        'one' => 50,
    ),
    'version' => 1,
);

After initial bucketing, you'll see a cookie (I used the web developer toolbar)
like so:

Name    mediaWiki.user.bucket:mykey
Value    1%3Azero

And "zero" would be returned.

If you then:

1) Update the version in the config from 1 to 2
2) Reload the page (and confirm that you have the new config, of course)
3) Attempt mw.user.bucket

It will still return "zero", and the cookie will still have the value
"1%3Azero".

EXPECTED:

A cookie like so, indicating re-bucketing:

Name    mediaWiki.user.bucket:mykey
Value    2%3Azero

WORKAROUND:

You can pass the version as part of the key:

mw.user.bucket( 'mykey@' + cfg.version, cfg )

Which will result in a cookie like this:

Name    mediaWiki.user.bucket:mykey@2
Value    2%3Azero

And will re-bucket when you change the version.

FIX:

https://svn.wikimedia.org/viewvc/mediawiki/branches/wmf/1.19wmf1/resources/mediawiki/mediawiki.user.js?view=markup

~ line 140, check the version from the cookie against the version in the
config, and set bucket to null if they don't match.  The check on line 141 will
then pass and re-bucketing will occur.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to