Page MenuHomePhabricator

IP auto-reveal: Enable and disable the mode globally
Closed, ResolvedPublic

Description

Summary

It would be helpful if IP auto-reveal mode could be remembered between different sites, for cases where a user is patrolling across different wikis.

Technical notes

The initial implementation of IP auto-reveal works locally, meaning that a user would need to enable it again at each site they are patrolling. This is because it uses localStorage, which is partitioned per origin. Some useful consequences of doing this:

  • localStorage is read and updated client-side, meaning that the auto-reveal state can be written and read without interaction with the backend.
  • MediaWiki's localStorage wrapper, SafeStorage, has a built in expiry.

Since we need this to work globally, we need a different mechanism. GlobalPreferences is a good mechanism for this, since:

  • it provides APIs for getting and setting the value
  • as with preferences, when set to false the database row will be removed
  • it is stable across different domains

Proposal:

  • Store the expiry time as a global preference
  • When checking the status, check if it has expired. If so, clear it.
  • Since there's no expiry mechanism, possibly add a maintenance script to remove rows containing expired values. The benefit may not be worth the cost here though, since only a limited number of users should use this preference.

Acceptance criteria

  • The auto-reveal status is remembered across wikis where the user is able to auto-reveal IPs

Event Timeline

Change #1130176 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] WIP IP auto-reveal: Set the mode globally

https://gerrit.wikimedia.org/r/1130176

Change #1133453 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] IP auto-reveal: Pass expiry to IPAutoRevealOffDialog

https://gerrit.wikimedia.org/r/1133453

Change #1133456 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/CheckUser@master] IP auto-reveal: Clean up expired global preference

https://gerrit.wikimedia.org/r/1133456

Change #1133453 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] IP auto-reveal: Pass expiry to IPAutoRevealOffDialog

https://gerrit.wikimedia.org/r/1133453

Testing notes

See how to test auto-reveal locally: T386500#10708399. Use those steps here when enabling or disabling auto-reveal mode, or extending the expiry time.

Steps:

  • Ensure prerequisites and setup from T386500#10708399 are followed for two wikis on a wikifarm
  • Test that enabling auto-reveal from one wiki causes auto-reveal to be enabled on the other
  • Test that disabling auto-reveal from one wiki causes auto-reveal to be disabled on the other
  • Test that extending the expiry on one wiki causes the expiry to be extended on the other
  • Un-assign the auto-reveal right on the first wiki: $wgGroupPermissions['user']['checkuser-temporary-account'] = true;
  • Enable auto-reveal on the second wiki
  • Test that auto-reveal is not enabled on the first wiki

Change #1130176 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] IP auto-reveal: Set the mode globally using a global preference

https://gerrit.wikimedia.org/r/1130176

Change #1133456 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] IP auto-reveal: Clean up expired global preference

https://gerrit.wikimedia.org/r/1133456

Djackson-ctr subscribed.

QA is completed, I have verified the new code has been implemented and is functioning as expected Per the Acceptance Criteria (The IP Auto-reveal status is remembered across wikis where the user is able to auto-reveal IPs).