Background
The Fundraising team will be running tests every Wednesday, throughout August. Because their analysts don't believe that we should apply the results from the previous test on itwiki to other wikis, the Fundraising team have requested that Page Previews re-expose whether previews are enabled so that it can be included in the analysis of the new tests.
AC
If the Popups extension is loaded on the wiki, then:
- mw.popups.isEnabled() method returns true when previews are enabled for the user; otherwise, it returns false.
- This is the case for all users.
- it returns false when popups conflicts with Navigational popups
- it works properly when popups are enabled as a beta feature
Developer Notes
- When popups are set up as a beta feature and they are disabled by user we do not ship Javascript code to the frontend. Because of that there is no possibility to setup mw.popups object.
- We talked about implementing this as a ES5 property access with a getter but not a setter, so that it is clear that the global variable is read only and cannot be set to manipulate popups. Also we are keeping the mw.popups.enabled interface so that the fundraising team don't have to update their code. Pseudocode:
mw.popups = { isEnabled = function() { return ... } }
- Also @phuedx mentioned using the getter to return the data from the store directly, instead of having to implement a change listener.