Page MenuHomePhabricator

Extract $skinOptions from SkinMinerva class
Closed, ResolvedPublic2 Estimated Story Points

Description

Minerva $skinOptions array is a part of SkinMinerva class. The problem is that SkinOptions are used in many places (main menu/page actions menu building, hooks, MinervaTemplate) and is going to be used in many more places (User menu, overflow menu). This is a crucial part of MinervaNeue system and it should be extracted to a separate service and properly hardened.

Acceptance criteria:

  • SkinOptions are available as service. SkinMinerva has to know nothing about SkinOptions implementation
  • PHPUnit code coverage has to be >95%
  • SkinOptions constants do not have OPTION_ or OPTIONS_ prefix.
  • allow only known options to be set
  • getting an unknown option should result in an exception

Developer notes

During code review of rSMIN258e635ae510: Extract SkinOptions to separate class we noticed many places where code can be improved a bit. That's why we added couple more AC (like "allow only known options" to be set, or "getting an unknown option should result in an exception"). The requested improvements are so small they do not require a new task, we should re-use this task and improve/harden the SkinOptions clas.

Event Timeline

Change 502905 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Extract SkinOptions to separate class

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

Change 502905 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Extract SkinOptions to separate class

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

@Jdlrobson IMHO it is not ready for signoff. During code review of https://gerrit.wikimedia.org/r/#/c/mediawiki/skins/MinervaNeue/+/502905, @Niedzielski pointed out couple minor flaws with existing code and I'd like to address those:
The merged task is just pure refactoring (extracting SkinOptions variable). No code changes, only moving stuff between files.

The Acceptance Criteria says:

  • SkinOptions constants do not have OPTION_ or OPTIONS_ prefix.
  • allow only known options to be set
  • getting an unknown option should result in an exception

Those bits are not done yet, if you prefer we can create a new task for code improvements, but those changes are so small, I think we do not need a separate task.

So this needs estimation? Can you add some notes to the task and add check marks to make it clear what's done and what isn't?

nray subscribed.
ovasileva triaged this task as Medium priority.May 28 2019, 4:32 PM
ovasileva moved this task from Incoming to Upcoming on the Web-Team-Backlog board.
ovasileva set the point value for this task to 2.Jun 18 2019, 4:49 PM

Change 526779 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Hygiene: SkinOptions should validate options

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

Change 526779 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Hygiene: SkinOptions should validate options

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

Change 527140 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Hygiene: Remove OPTIONS_ and OPTION_ prefixes from SKinOptions

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

Change 527141 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/extensions/GrowthExperiments@master] Hygiene: Remove OPTION_ prefix from Minerva SkinOptions

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

pmiazga updated the task description. (Show Details)

Change 527140 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Hygiene: Remove OPTIONS_ and OPTION_ prefixes from SKinOptions

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

Change 527141 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] Hygiene: Remove OPTION_ prefix from Minerva SkinOptions

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