Commit graph

10 commits

Author SHA1 Message Date
Piotr Miazga 2988a6e620 Hygiene: Move Popups.hooks into includes folder
Lets keep all extenion PHP files in one folder

Change-Id: I225019b895df038c1d43a082ac4244053d0b96dd
2017-02-14 21:04:49 +01:00
jdlrobson 64e7bfd620 Hygiene: Rename isEnabledByUser to shouldSendModuleToUser
Sometimes we make choices on the users behalf if we don't have
sufficient information, so this name is more applicable.

If beta features is disabled and the user is anon they have not
explicitly opted in.

Change-Id: I5d816f569fc54f8bf74d6e5a06246b7fa7036e06
2017-02-10 10:07:28 -08:00
jdlrobson 4e2ce1ce39 Only add Popups code to output page where needed
If the Popups code is enabled in beta feature mode only then
only add it to the page if the beta feature is enabled.

isEnabledByUser now returns false if the user is anonymous
and Popups is restricted to beta mode.

Bug: T156290
Change-Id: If152d2a67a079050173c6d642e0960b59730bc6d
2017-02-09 10:43:53 -08:00
Piotr Miazga c13ab30bfa Move conflicting NavPopups gadget name into config var
Changes:
 - removed hardcoded comflicting Navigation Popups gadget name
 - introduced a config variable to specify conflicting gadget name

Bug: T151058
Change-Id: Ief5c6f90ec6dd6c074931f7d9ff20297d4718fe5
2017-01-12 18:07:20 +01:00
Piotr Miazga 211f1d1658 Disable Page Previews preferences when NavPopups are enabled
Changes:
 - introduced PopupsGadgetsIntegration class handles all checks
 - show help message on Preferences page when NavPopups is enabled
 - unit test everything

Bug: T151058
Change-Id: Ia474b1b30378efe84dedf3ad47c1f833e88d69b5
2017-01-11 01:06:48 +01:00
Piotr Miazga 05eccb31c1 Hygiene: use UserGetDefaultOptions instead of ExtensionRegistration
Changes:
 - removed onExtensionRegistration and related TODOs
 - introduced onUserGetDefaultOptions hook

Change-Id: I6648802c19d90df36a211d6494033aca30c078ca
2017-01-10 18:34:43 +01:00
Piotr Miazga c587a9785b Hygiene: Improve code quality by reaching 100% coverage
Changes:
 - added missing unit tests
 - introduced PopupsContextTestWrapper, removed all unit-tests logic
   from Hooks/Context classes
 - removed getModule() from Popups.hooks.php, it's hooks responsibility
   to keep single context instance
 - removed class_exists calls, use ExtensionRegistry instead
 - pass ExtensionRegistry as a dependency so it's easy to mock
 - reach 100% code coverage
 - introduce PoupsContext::isBetaOn() as it was used in many places

Change-Id: Id014efe72edf24628539c76968e53eb3e06709f4
2016-12-21 16:03:33 +01:00
Piotr Miazga 147772bbd8 ext.popups module should be loaded for anon users
Bug: T146889
Change-Id: I11dc6208334daa556d376f04aeb099a2642fcec0
2016-12-21 10:38:36 +00:00
Piotr Miazga 959bf40d9b Implement necessary wiring for preferences
Changes:
 - introduce unit tests
 - don't send module for anonymous users
 - renamed Module to Context
 - remove Config dependency from Popups.hooks.php

Bug: T146889
Change-Id: I3cbcdc1303411b28b613afa6dd1a00b410891471
2016-12-20 16:54:33 +01:00
Piotr Miazga f597e341af Introduce Opt-In option on user preferences page
This changes introduces new option on Special:Preferences page that
allows users to enable/disable Page Previews feature.
By default feature is disabled. Temporarily option in Preferences
page is smoke and mirrors as switching logic is still WIP.

Bug: T146889
Change-Id: Ifdd17ce265d2d4c7583433ed4991443c563f1fe3
2016-12-16 01:06:59 +01:00