Fix preference tab switching so it doesn't fight prevTab v url hash
authorMoriel Schottlender <moriel@gmail.com>
Fri, 21 Apr 2017 00:19:47 +0000 (17:19 -0700)
committerMoriel Schottlender <moriel@gmail.com>
Fri, 21 Apr 2017 00:19:47 +0000 (17:19 -0700)
commit273076e69776c7cdd0aaab08cec559bd79601a14
tree2779ce160ac0b11ad0b97c4b7d1ac3a5415ae616
parentb2b565909dc8627b191f4ec5e0eff978f9fa9751
Fix preference tab switching so it doesn't fight prevTab v url hash

There was a bug where, when loading the Preferences page, the tab
was initially set by the URL hash (correct behavior) but then later
the system asked for the 'previous tab' in session storage, and changed
it to that -- which overrode the URL hash placement. In most cases,
the previous tab and url hash seemed to have been correct because
the user would go to the Preferences section and expect whatever
was the most recent tab they saw to open - but in the case of
specifically hitting "Beta" link (or clicking a direct link with
a specific hash to one of the preferences tabs) the previous tab
and hash had a fight, where the url-hash was the loser.

This commit fixes that by deleting the 'previousTab' from session
when the hash is set. Also, as a bonus, made sure that when the
previousTab removes itself from session, it actually removes the
correct key (and not tries to remove the value, which it did up
until now, and would've resulted in the previousTab value never
actually being removed)

Bug: T162938
Change-Id: I95c809f41dec7d7120c73dffa4a107346d049f70
resources/src/mediawiki.special/mediawiki.special.preferences.js