Page MenuHomePhabricator

Implement "hidden" gadget feature (pre-Gadgets 2.0)
Closed, ResolvedPublic

Description

The hidden attribute has been part of the RL2/Gadgets 2.0 branch from the start. A similar workaround (rights=hidden) has also merged for the current version of the Gadgets extension.

All of this logic has also been merged in the master branch last year, but is currently usable via the GadgetDefinitionNamespaceRepo. The MediaWikiGadgetsDefinitionRepo doesn't currently look for this attribute when parsing the definitions.

Let's add it there as well.

Below the original request from BugZilla about the same feature:


Author: beau

Description:
Patch adding a new gadget attribute: hidden

Before ResourceLoader was created Gadgets extension offered nice way to reuse common (library) code in gadgets - it is possible that two gadgets use a same js/css page. Such page is loaded only once.

New implementation based on ResourceLoader duplicates code for every gadget. So the same library will be downloaded and executed many times.

I would like to request a new attribute 'hidden' for gadgets, which should not be displayed in preferences. This attribute allows creating ResourceLoader modules which can be referenced by dependecies parameter.

Example use case:

  • awesomeLibrary [ResourceLoader | hidden] | fileA.js | fileB.js | thisLibraryHasStyle.css
  • awesomeGadget-1 [ResourceLoader | dependencies=ext.gadget.awesomeLibrary ] | awesomeGadget-1.js
  • awesomeGadget-2 [ResourceLoader | dependencies=ext.gadget.awesomeLibrary ] | awesomeGadget-2.js

Attached:


See also: * T41025: Gadgets 2.0: "hidden" doesn't work

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:51 PM
bzimport set Reference to bz31150.
bzimport added a subscriber: Unknown Object (MLST).

This is already implemented in /branches/RL2

beau wrote:

I am aware of that, but I was hoping that it would get deployed on WMF wikis before MW 1.19...

No, not going to happen. Too many changes.

Gadgets/ResourceLoader 2.0, among many new features, introduces the gadget setting "hidden".

(In reply to comment #0)

Before ResourceLoader was created Gadgets extension offered nice way to reuse
common (library) code in gadgets

This is still possible. the same way as it used to be, nothing changed. Ofcourse after ResourceLoader it is recommended to use a hidden module to avoid loading the same code twice, but what you describe here is still perfectly possible.

Marking INVALID as this was already done.

Well, it could be done without all the new changes, in the old extension.

I don't have time to review and deploy, but if Roan sees fit, we could do this in advance.

beau wrote:

If it is too much effort I can always use a workaround "rights=abusefilter-view-private". I don't like such solutions, however as no one is supposed to have this right, it will work...

You can even use nonexistent rights for that purpose.

beau wrote:

I am using rights=hidden in gadget definition as a workaround. I am closing this request as WONTFIX.

Krinkle renamed this task from Make it possible to register RL modules using Gadgets extension (aka "hidden gadgets") to Implement "hidden" gadget feature (pre-Gadgets 2.0).Nov 18 2016, 4:21 AM
Krinkle reopened this task as Open.
Krinkle claimed this task.
Krinkle triaged this task as Medium priority.
Krinkle updated the task description. (Show Details)
Krinkle set Security to None.
Krinkle added a project: User-notice.
Krinkle removed a subscriber: wikibugs-l-list.

Once merged, this should be announced in Tech News as well.

Change 322233 had a related patch set uploaded (by Krinkle):
Implement support for 'hidden' feature in MediaWikiGadgetsDefinitionRepo

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

@Krinkle How would you suggest phrasing it in Tech News?

@Johan Perhaps something like this:

This week a new "hidden" option comes available for Gadget definitions. This allows registering of gadgets that cannot be enabled/disabled from the preferences page. See mw:Extension:Gadgets#Options and phab:T33150 for details. Hiding gadgets was already possible by using [rights=hidden]. The [hidden] format should now be used instead. Please migrate use of [rights=hidden] to [hidden].

Change 322233 merged by jenkins-bot:
Implement support for 'hidden' feature in MediaWikiGadgetsDefinitionRepo

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

Change 323116 had a related patch set uploaded (by Krinkle):
Implement support for 'hidden' feature in MediaWikiGadgetsDefinitionRepo

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

Change 323116 merged by jenkins-bot:
Implement support for 'hidden' feature in MediaWikiGadgetsDefinitionRepo

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

@Krinkle Should this be in next Tech News (distributed on Monday) or what's the timeframe?

@Krinkle Should this be in next Tech News (distributed on Monday) or what's the timeframe?

Yep. This will roll out in the next train deployment (1.29.0-wmf.4), which starts next week on Nov 29.