Commit Graph

350 Commits

Author SHA1 Message Date
Jan Drewniak 69511f16b6 Add history icon to page actions menu for AMC mode
Bug: T213352
Change-Id: I6ba11c5969e03bf71fb891558fde68215e978083
2019-03-07 00:45:53 +00:00
Jan Drewniak 864a1766a7 Refactor pageActions menu to accommodate AMC mode
This patch refactors the markup and JS associated with the page actions
menu in order to achieve greater flexibility in its presentation.
The menu items are now positioned via flexbox and rendered using a mustache
template in PHP.

The goal of this refactor is to accommodate both AMC mode and default
mode with the same markup. No changes should be visible for non-AMC
users with this refactor. No changes to AMC mode have been made in this
patch either.

This patch includes temporary workarounds to avoid problems caused by HTML caching.

Changes include:
- Changing the data structure of the page_actions property in SkinMinerva.php
- Passing that modified data structure into a new mustache template, PageActionMenu.mustache
- Adding new CSS for the new page actions menu HTML
- changing the query selectors in JS to match the new markup
- Making the JS-modified page-actions compatible with the new markup
- Keeping existing CSS and JS to avoid breaking cached HTML

Bug: T213352
Depends-On: I95cf726c4b6d8c3895a26aa6e07f4b1747ee30fe
Change-Id: I5a7d73b20617cb3c6d6379084ac4bea23ec3bc74
2019-02-28 12:31:57 +01:00
jdlrobson 3f7d1e3601 Return to link is not needed in AMC mode on talk pages
The tabs render this unnecessary

Bug: T212216
Change-Id: Ibb19448529a43bb542eb112ff3b113ca0c3749a4
2019-02-26 10:33:26 -08:00
jdlrobson d3a95084c5 Talk is at bottom of main page
In T214724 the talk tabs were removed from the main page in
AMC mode, however this also removed the talk button
altogether in AMC mode. This updates the logic.

Talk tabs are also
removed from the talk page for the main page
as the tabs come as a pair.

Bug: T214724
Bug: T216514
Change-Id: Ic7d54e323d9428fa222e27a86ec2f9d61ae1e5f5
2019-02-20 14:03:03 -07:00
jenkins-bot b32056350a Merge "Banner now nested inside main article at top" 2019-02-20 20:01:25 +00:00
jdlrobson 1146ebd2d9 Banner now nested inside main article at top
Bug: T205360
Change-Id: Idebb161519e0b50c1f464f409ffdf62b634a4e6d
2019-02-20 11:17:09 -08:00
Jan Drewniak f92b117158 Remove margin from tagline and add .page-heading element
Even though on most pages the tagline is empty, it still
has a bottom margin associated with it. This patch moves
that bottom margin into a container element that wraps
both the h1 and tagline.

This approach allows us to remove the bottom-margin from the tagline
as well as the top-margin from the AMC tabs in favour of just
one bottom margin on the .page-heading element.

Bug: T214195

Change-Id: I67d3938ab4a75f994acc28a8eefdf19e531c1f3d
2019-02-19 12:37:27 +01:00
jenkins-bot 25d71b432e Merge "User actions below page actions" 2019-02-18 14:39:18 +00:00
jdlrobson 260fa21bfd Define AMC flag as false by default
Not doing this triggers a PHP notice on all pages

Change-Id: Ie171e53985a56c27d91aa6bae19a0d3f60bc9619
2019-02-13 13:44:05 -08:00
jenkins-bot 74c6e33093 Merge "Talk tabs disabled on main page" 2019-02-13 20:10:39 +00:00
jdlrobson 4807b3c6fd User actions below page actions
I have decided not to worry about cached HTML.
Some pages will display the links inconsistently, but that's
okay.

Bug: T214697
Change-Id: I16f0f999f915aed8316d8a9b4fbbed9a2971d59e
2019-02-13 11:41:28 -08:00
jenkins-bot a2173b0061 Merge "Remove backwards compatible CSS" 2019-02-13 05:36:17 +00:00
jdlrobson 577b72a14d Remove backwards compatible CSS
This is no longer needed when Varnish cache has cleared (About a
week from I7e989a3d4553eb3357598a5cad3ccebf51dc9fae being deployed

Bug: T212216
Change-Id: I1afb68f68cc90d89c442907426bd046ddc68f488
2019-02-12 17:40:49 -08:00
jdlrobson e54d7feb06 Talk tabs disabled on main page
Bug: T214724
Change-Id: I0acbfcbbfa333e2d22f6d2caf285ad00ca71b14a
2019-02-12 17:25:56 -08:00
Stephen Niedzielski 3dc9cff2c2 Hygiene: separate page issue view logic
- Move page issue view components that do not modify the DOM during
  during construction to PageIssueLearnMoreLink.js and PageIssueLink.js.
  PascalCase is used optimistically for filenaming in the hopes that
  these functions can become something like a JSX component. A "new"
  function prefix is used in the meantime.

- Move page issue view logic that munges the existing DOM to
  pageIssueFormatter.js. Substitute "create" prefixes for insert so that
  clients won't forget that calling the function is a modify operation.
  Alternative naming welcome but it shouldn't be confused with more
  idealistic components that do not depend on DOM state for
  construction.

- Consolidate createPageIssueBanner() and
  createPageIssueBannerMultiple() into insertPageIssueBanner() as the
  code was quite similar and were it a true component, it would probably
  be a single component.

All new files appear under page/ to keep their distinction from the
overlay code clear.

Some view logic remains in pageIssues.js but it shall be difficult to
isolate.

Bug: T212376
Change-Id: Iccce709c34fa8de5a28a5a00098add5775e3dc9a
2019-02-13 00:42:56 +00:00
jdlrobson 7e423c07b7 Talk tabs in AMC mode
A new feature/skin option is added that is enabled safely inside
a MobileFrontend available/unavailable hook that changes the skin
to place talk tabs at the top of the page.

These new talk tabs purposely show on the main page, user page
and standard pages and do not show on special pages.


Depends-On: Ie1a583657176acc6f7046c569c2e94fa2f72ff93
Bug: T212216
Change-Id: I57b70cd325666a287678dc897159b5bf9d089b78
2019-02-13 00:02:35 +00:00
Derick Alangi ef1c89fc1d Remove legacy behavior from hook handler function
Change-Id: I96d6942cf6bf23652942d5ebe456a1f01e805556
2019-02-10 12:04:19 +01:00
jenkins-bot cbd624d6ab Merge "page actions is no longer position absolute" 2019-02-08 19:22:42 +00:00
jdlrobson b356c7f134 Merge skins.minerva.scripts.top and skins.minerva.mainMenu into scripts
These modules can safely be merged.

Since skins.minerva.scripts.top is added via addModules to the HTML it must
be marked as deprecated and remain temporarily as a redirection to skins.minerva.scripts

All modules have been renamed to be in there new home - no deprecation notices are needed
as they are not used outside Minerva.

I leave skins.minerva.mainMenu.styles as it is used by Special:MobileMenu
and needs to continue to do so.

Change-Id: Ie919151630f4389f8e84e808bec003a6d3d07bd9
2019-02-07 18:10:15 -08:00
jdlrobson 95b139d756 page actions is no longer position absolute
This was causing lots of problems with the AMC design and seems
unnecessary. It dates back to tablet support added in
I14c8182473c9508ffc38a8d5baf114bcb016a35f in 2014. This no longer
appears to be needed for tablet.

Changing the HTML means we need to be careful about Varnish cached
HTML with new styles. To avoid UI regressions we use a new temporary
class heading-holding--new which will be removed as soon as possible.
The no-page-actions modifier is no longer needed given the new heading
holder doesn't care what's inside it.

Bug: T212216
Change-Id: I7e989a3d4553eb3357598a5cad3ccebf51dc9fae
2019-02-07 12:16:14 -08:00
libraryupgrader 63e52a302a build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: Ie071cb13e535f3fe168bc6cf780b21add90b4b8a
2019-02-07 07:51:12 +00:00
jdlrobson 4d734942c5 Remove large bottom margin at top of main page
Main pages do not have page actions, yet the header always adds
bottom padding to compensate for the fact that page actions are
absolutely positioned.

a new class is added adopting BEM notation that informs the client
that no page actions are going to be visible. In conjuction to this
we strip the relevant HTML from the DOM.

Bug: T212216
Change-Id: Ib69991e91160ba7e2ca3beca4475c2a06c4b9cd3
2019-01-23 12:10:06 -07:00
jdlrobson e34cb9c509 Restore banners to Wikivoyage project
Restore prebodyhtml which was removed in
41b59d4a2b
by mistake in the process wiping out all Wikivoyage banners
on mobile

Change-Id: I6c31363d682ea4a714942fc9f94a9c85e1a8b9d9
2019-01-23 09:02:58 -08:00
jenkins-bot ffb97f5c9f Merge "Hygiene: Merge skins.minerva.base.reset into skins.minerva.base.styles" 2019-01-18 17:13:52 +00:00
jenkins-bot a816f81278 Merge "skins.minerva.tablet.styles can be merged" 2019-01-18 17:13:51 +00:00
jdlrobson 8cf642aa00 Drop usage of mobile.ajax.styles
From now on we'll make use of ConfirmEdit's styles.

Depends-On: Ic3a8c2cfce92659d5efc4da8799613afba544cea
Bug: T213775
Change-Id: I0a602a20178998ae997b6e5498b6548610936acd
2019-01-16 01:48:42 +00:00
jdlrobson 24b1e7d54d Hygiene: Merge skins.minerva.base.reset into skins.minerva.base.styles
No need for 2 modules that are both loaded on every page load
Provided consumers are loading skins.minerva.base.styles they will
continue to get the same CSS. If any consumers exist that load
skins.minerva.base.reset but not skins.minerva.base.styles they will
need to use their own css reset file
(e.g. https://meyerweb.com/eric/tools/css/reset/)

Change-Id: I599e6d5a84b311cb3bb2da197da1b688e0e6b9d4
2019-01-15 12:30:32 -08:00
jdlrobson 1166009c00 skins.minerva.tablet.styles can be merged
This module is unnecessary - it's loaded unconditionally on a page.
Instead bundle the related CSS inside skins.minerva.content.styles

Change-Id: Ieb37d63332ff5b0cf39835b64cc9f0dcaf62c34f
2019-01-15 12:30:30 -08:00
jenkins-bot b06a079a81 Merge "Move HTML construction to Minerva template and simplify" 2019-01-15 15:09:01 +00:00
jdlrobson 41b59d4a2b Move HTML construction to Minerva template and simplify
Right now the HTML construction is split between MinervaTemplate
and minerva.mustache

I'd like to move all of this to mustache to make it easier to see
how to make changes.

Additional changes:
* footer-site-heading-html was previously mapped to headinghtml
The template variable has been renamed to avoid confusion.

Change-Id: I1dfe15f6f74b51b152c206e2ea63ae460d704ab6
2019-01-14 15:27:55 -08:00
zoranzoki21 5404c85e86 Fix transcuded typo
Bug: T201491
Change-Id: I705b20bc1fd8bc014c614521dc54de69fc300b26
2019-01-13 13:10:48 +00:00
jenkins-bot 19cf51602e Merge "Hygiene: Simplify Nearby menu item registration" 2019-01-04 18:00:53 +00:00
jdlrobson d8a8410a8d Hygiene: Simplify Nearby menu item registration
The Special:Nearby page is only available if wgMFNearby is
enabled so the first 2 checks are identical.

If the page is enabled, we should be able to assume the
sysop knows what they are doing and avoid all  these
unnecessary checks. It seems foolish to also check the
existence of Geodata or a NearbyEndpoint

Additional change:
* Don't use deprecated SpecialPageFactory. Use the service
instead.

Change-Id: I3a4b8fa55fc7f29c90f7173d1d973d5f4f759a6b
2019-01-04 09:13:19 -08:00
jenkins-bot 9258806a0f Merge "pageIssuesOverlay is a factory function that returns an Overlay" 2019-01-04 15:39:48 +00:00
jdlrobson d29eca2bc8 pageIssuesOverlay is a factory function that returns an Overlay
This experiments with making PageIssuesOverlay an Overlay with
various options.

The appending of children is a little messy and points at a need
to standardise this some way
(see https://phabricator.wikimedia.org/T209647)

TODO:
* Remove the iconString property on PageIssueSummary which is no longer
needed

Bug: T209647
Change-Id: Iadd798a820dca6bbb31edc9a8570b6db7aac237a
2019-01-03 08:31:39 -08:00
jdlrobson c73ff1f7a5 Composition: DownloadIcon
The DownloadIcon is reduced to a factory function that
returns an instance of Icon

Depends-On: I4d703eef68d51bbe0b03579c5cca0845e17b8c9d
Depends-On: I4a4129b2cac7c7c49559beef0b8780f3211edf9c
Bug: T205592
Change-Id: Ib87390d17bef6f50842f52cd84c9ce2b162aaff0
2019-01-02 13:16:09 -08:00
jdlrobson 97fd861a63 page issues is feature flagged
* New feature/skin option is added and value is read inside
the pageIssues setup code
* issues-group-a class is added to page on server side to remove
the flash of unstyled content
* issues-group-A class is dropped (it's not doing anything!)
* The minerva-issues flag will now accept any value to avoid confusion.
It is used to override the default setting of wgMinervaPageIssuesNewTreatment
A note has been added that this can be removed in future.

Bug: T206179
Change-Id: I3d98fd8f8e1adc818ea03589d2c8f68fe991e861
2018-11-20 12:41:41 -08:00
jenkins-bot 5a2cfe3623 Merge "Remove 'skins.minerva.editor' module (moved to MobileFrontend)" 2018-11-14 23:37:31 +00:00
Bjornskjald dc61408a59
Add checking if template should output <sup>β</sup>
Bug: T208185
Change-Id: I4d564d9398947ea650b935b42cf79ef4a36d1b7e
2018-11-14 21:39:26 +01:00
Bartosz Dziewoński b17d3f70da Remove 'skins.minerva.editor' module (moved to MobileFrontend)
Added in MobileFrontend in Iaaed72c32b9c4f4e15c320b79e29e9af3609069a.

(The module's name is included in cached page HTML, so to avoid
breaking them, 'skins.minerva.editor' must temporarily remain as an
alias for 'mobile.editor'. It is otherwise unused and can be removed
after caches expire on Wikimedia wikis.)

Depends-On: Iaaed72c32b9c4f4e15c320b79e29e9af3609069a
Bug: T198765
Change-Id: I52c4e0941dcf8f176e3ac32d8a1f72a0f8e1d6a6
2018-11-13 23:27:29 +01:00
jenkins-bot 90629a0578 Merge "Move canEdit checks to server from client" 2018-11-09 22:07:47 +00:00
arcayn c64a4cf811 Move canEdit checks to server from client
Bug: T206262
Change-Id: I08bfc56998f4fb42c8ce76cc2ad9fba83106d476
2018-11-09 21:26:49 +00:00
jenkins-bot 65b00b4a41 Merge "Merge remote-tracking branch 'gerrit/page-issues-cleanup'" 2018-11-09 01:11:10 +00:00
Bartosz Dziewoński 7b5928d795 Merge remote-tracking branch 'gerrit/page-issues-cleanup'
Bug: T198765
Bug: T208514
Change-Id: I9467101c9b01cbd7682de859e43e04966760eea6
2018-11-08 16:00:39 +01:00
jdlrobson dabb909887 No Minerva variables should be loaded on a non-Minerva skin
Bug: T186062
Change-Id: I13c2ca804e92bc2ab839b370de48299c2ccd474f
2018-11-07 11:04:00 -08:00
jenkins-bot 69eddce6be Merge "Disable mobile editor (skins.minerva.editor) on desktop" 2018-11-05 22:11:12 +00:00
jdlrobson 6a73c395f1 Don't ship wgMFDescription if you're not using it
There are no occurances in the codebase using this description
so do not include it.

Bug: T186062
Change-Id: Icd06329af2756d3fcd143deab528e6a7c7d56d30
2018-11-01 18:58:49 +00:00
Volker E b4287378fd Provide ARIA label on main search input
Bug: T208290
Change-Id: I594ab47ffcba3596e52f02a751eaed6084db207b
2018-10-29 22:21:27 -07:00
Bartosz Dziewoński d57f8290c3 Disable mobile editor (skins.minerva.editor) on desktop
This module is no longer necessary to allow editing pages in the
Minerva skin. When it is not loaded, the normal desktop editor will
be used instead (that may be WikiEditor, VisualEditor, just the plain
textarea from MediaWiki core, or something else).

Bug: T198765
Bug: T208068
Change-Id: I1eb9d4b4bc937522e527dbdc0d6be82baf3b7413
2018-10-30 03:46:13 +01:00
jenkins-bot 6cf66a2ad8 Merge "Revert "`autocomplete` is not necessary on `search` input types"" 2018-10-30 00:15:05 +00:00
Jdlrobson b71e36313f Revert "`autocomplete` is not necessary on `search` input types"
This reverts commit 05fd384803.

Looks like it is needed.  On android i am now seeing autocomplete unexpectedly...

Change-Id: I9c4476346c183d6dcc9e25965530f3e2478ed88f
2018-10-27 06:03:00 +00:00
jenkins-bot a79a0276bd Merge "Add "Discussion" button to Main page on Mobile View" 2018-10-23 20:18:50 +00:00
jenkins-bot 885092114b Merge "Watchstar is accessible to non-js users" 2018-10-23 20:09:40 +00:00
jdlrobson 72cd31f221 Remove page issues instrumentation
Note, since the page issues code is not feature flagged,
the new treatment will only be accessible via query
string until T206179 is taken care of.

Bug: T206178
Change-Id: I5ab2f3396e642f7b973263e2bb3963e0e82721b3
2018-10-23 12:19:25 -07:00
Alangi Derick a2fd0b3c1f Add "Discussion" button to Main page on Mobile View
* Enable discussion button on main page in mobile view so users
  can view discussion topics related to the main page on mobile.
* Update test to make sure only 'talk' and 'switch-language' actions are
  enabled on the main page and 'edit' and 'watch' are disabled on the main
  page.
* Minor typo fix for doc type. Use "array" instead of "Array" and CSS
  alignment fix issue with Discussion button when displayed together with
  Language selector button.
* [Suggested by: @Jdlrobson] Use a generic "a" CSS selector to style the ".talk"
  and ".language-selector" classes on the main page. This also avoids fixing the
  CSS for future buttons if added (future proofing the code), so if any other
  button is added in the future, the same css rule will be applied to it at once.
  Very wise idea from @Jdlrobson, thanks!

Bug: T206406
Change-Id: Iedce84595adc357f3a707f8b94d23b2ffea3476c
2018-10-23 19:59:22 +01:00
jdlrobson aa6a2dda4c Watchstar is accessible to non-js users
Bug: T196893
Change-Id: I5dbd164ba68e6c74e80f8bcf90819a526cda5a5e
2018-10-19 11:00:19 -07:00
Fomafix 133e806865 Force type Language for $lang of doEditSectionLink
Also make the parameter $tooltip mandatory to ensure that a mandatory
parameter does follow an optional parameter. ParserOutput always fill
all parameters of doEditSectionLink.

Bug: T207413
Depends-On: Ic49d76c7d9357f99b462471696f7e1eb86e70e3d
Change-Id: I49c1e3fb7bf72002c7f498d4afe14a06caf411f8
2018-10-18 22:13:29 +02:00
jenkins-bot 26e29baf8d Merge "Show watchlist to non-JS users of Minerva" 2018-10-15 09:16:01 +00:00
Piotr Miazga 51b6e8209b Add share icon as mobile web beta feature
Add a new beta feature - share icon. When user opts into beta
the share icon will be visible on supported devices (Android OS
and Chrome browser).

Bug: T181195
Change-Id: Ie4b9dd05eea9b63422bd174048d8b1251cb02bf4
2018-10-12 22:08:28 +02:00
jdlrobson cbad0bd363 Merge skin option modules into a single ResourceLoader module and move enabled logic to client
It's presumed that skin options will eventually become the default or be removed from the skin.
While they are not the default, it would be helpful to package them in one single module - as ResourceLoader
modules are costly bloating the dependency graph in the MediaWiki startup module.

In T167713 we talked about grouping our entry points by page rather than feature, which this seems consistent
with. A page with special options enabled is different from a page without.

Change-Id: Id948f913d4743532ba3442d2059a03c122419ff2
2018-10-12 10:18:21 -07:00
jenkins-bot 5d4ad087c1 Merge "Remove code related to no-anonymous-editing mode of MobileFrontend" 2018-10-11 20:27:33 +00:00
jdlrobson 3f674008a3 Show watchlist to non-JS users of Minerva
Bug: T196893
Change-Id: Ibd52079d3862854c9c88dae87501b0d42ae99716
2018-10-10 14:08:59 -07:00
Bartosz Dziewoński cada514ded Remove code related to no-anonymous-editing mode of MobileFrontend
All of this would only be used with the configuration setting
`$wgMFEditorOptions['anonymousEditing'] = false;`.

Removed features:
* Call-to-action popup in skins.minerva.editor (note that anonymous
  editors still get a CTA from MobileFrontend's EditorOverlay code)
* Pointer towards the edit button shown after registering via the CTA
  (entire skins.minerva.newusers module)

Bug: T205382
Change-Id: I66c7035f7a23581811dda87c911dea41d4a8e5da
2018-10-10 19:03:53 +00:00
Volker E 05fd384803 `autocomplete` is not necessary on `search` input types
Attribute doesn't provide any functionality on `type="search"`.

Change-Id: Ibf571b100155defa7188354f85586ea6d31dc720
2018-10-09 03:45:31 +00:00
jdlrobson 07a3b81c91 Errors can be counted in statsv
Bug: T205582
Change-Id: I8f67b8356ac271872cac39a416ffefce47959177
2018-10-08 15:05:56 -07:00
jenkins-bot 57cb5f8e41 Merge "Make Minerva section editing more like other skins" 2018-10-04 21:26:03 +00:00
Bartosz Dziewoński 6b0ce86410 Make Minerva section editing more like other skins
Goal: Make skins.minerva.editor not rely on Minerva-specific markup.

SkinMinerva.php:
* Add `class="mw-editsection"` to section edit links in SkinMinerva.
  This is the default behavior in SkinTemplate.
* Tweak the page "Edit" link generated in PHP to be the same as the
  link we were generating in JS: add class="edit-page" and change the
  message for the text.
* (Fix an unrelated code comment that was incorrect.)

skins.minerva.content.styles/hacks.less:
* Remove a hack that was hiding .mw-editsection, since we now use it.

skins.minerva.editor/init.js:
* Stop using the `data-section` attribute on links to decide which
  page section to open in the editor. Instead, use the `href`
  attribute and extract the `section` URL parameter from it.
* Stop using the `edit-page` class to find section edit links.
  Instead, use the `mw-editsection` class.
* Remove super weird code that removed the original "Edit" link from
  the page and generated an identical one to replace it, instead of
  just adding event handlers to the existing one.
* Centralize event handling for all types of edit links.

Bug: T198765
Change-Id: I79639c738ff1c3ec4b48ee2e462d23060151a21b
2018-10-04 14:07:27 -07:00
jdlrobson 33a7484676 Move MainMenu click tracking schema from MobileFrontend to Minerva
Additional changes:
* Rename hook prefix from 'mf.' to 'minerva.'
* Remove now unnecessary RL call

Bug: T204584
Change-Id: I50619e71c5a98e95c8aed3c3f346d4cb8a70abbe
2018-10-02 15:03:17 -07:00
jdlrobson 87924e7e25 Add `theme-color` meta tag to Minerva
For non-web-apps we can still control the color of the address and
status bar. Currently this is defined in MobileFrontend)
but is configurable if we ever want to change it. If not defined
(e.g. no MobileFrontend/no config) it is not added.

Bug: T204691
Depends-On: I39c0905f86edc4f52235b905850c31257e7f792e
Change-Id: I3ab0f538fb6ae3332574fd212eea1a7ec6a397bd
2018-10-01 14:25:25 +00:00
Piotr Miazga 71cbed60fb Create $returntoquery variable properly
The $returntoquery variable is created only when request wasn't
posted, but the variable can be accessed on POSTed request.
To fix that issue we need to always define $returntoquery as
an empty array. This is done in order to prevent leak of
any sensitive data sent by POST request.

The sample error from fatalmonitor:
Undefined variable: returntoquery in
skins/MinervaNeue/includes/skins/SkinMinerva.php on line 701

Bug: T205449
Change-Id: I20e5955ddcb99c110a3dc03fb3b56c1904601453
2018-09-26 15:36:44 +02:00
Piotr Miazga 8c587c58c9 Fix broken config name for MinervaABSamplingRate
Bug: T205355
Change-Id: I983866f177c4ea994954f5236b2820a7f0b8b661
2018-09-25 14:45:51 +02:00
jenkins-bot 5596488f9d Merge "Minerva A/B tests are not subject to HTML caching time" 2018-09-25 09:32:35 +00:00
jdlrobson 58c0b8131f Minerva A/B tests are not subject to HTML caching time
Config added inside SkinMinerva is subject to the rules of HTML
caching and can take several days [1]

Adding it via the onResourceLoaderGetConfigVars hook reduces the
cache time to minutes [2], giving us more control over the experiment's
enabled state.
[1] T124954
[2] https://www.mediawiki.org/wiki/ResourceLoader

Bug: T205355
Change-Id: I18cb40afe405e2f6a89a7ce5a924eb855aed5430
2018-09-24 22:49:34 +00:00
Bartosz Dziewoński 992630c705 Remove broken remains of &campaign=leftNavSignup handling
This code could never be used under normal circumstances since
a crucial bit of it was removed from MobileFrontend in 2015:
(I65e943b6dad8bfea994020f9f555bd095da1a171)

    // Allow us to distinguish sign ups from the left nav to logins.
    // This allows us to show them an edit tutorial when they return to the page.
    if ( $query['returntoquery'] === 'welcome=yes' ) {
    	$query['returntoquery'] = 'campaign=leftNavSignup';
    }

…and honestly, that's for good, because it fails horribly
when triggered by adding &campaign=leftNavSignup to the URL
manually: clicking "Start editing" in the callout navigates
you to an article called "Undefined/leftNavSignup".

Bug: T205325
Change-Id: I0e385488be5b2eaa7d489029b91e18b336c0d133
2018-09-24 19:30:03 +00:00
Bartosz Dziewoński 786ec45c30 SkinMinerva: Remove incorrect comment
'returnto' is, in fact, set a few lines above this comment,
since 2013 (I1553ee71f4f9ffec8462e3f9b85de9f39d921204).

Change-Id: I20ab084b3ddf59d338268f00a7f2306c9e2bd2b3
2018-09-21 19:57:15 +00:00
jenkins-bot ee5959a6fb Merge "Get rid of ICustomizableSkin" 2018-09-21 16:03:47 +00:00
Jan Drewniak 2163d5f965 Rename QUnit test files from "test_" to "test.js"
Updates QUnit test files from starting with "test_" to ending with
"test.js" in accordance with the Readers Wed coding conventions.

https://www.mediawiki.org/wiki/Reading/Web/Coding_conventions

Bug: T197884
Change-Id: I98877e3fc432b6edd0c53d834ef23b3ef8fb7d6a
2018-09-19 08:01:31 -06:00
Ed Sanders fd517597aa Add a notifications overlay container to the skin
Bug: T202466
Bug: T202620
Depends-On: I5a78949efef88083bdafc4207a6872c76b463970
Change-Id: I4c05ec666d5cbc93c12c35ab8222871e698f345c
2018-09-06 16:25:19 +00:00
Kunal Mehta 23d21c4ae7 Set explicit output formats to prevent over escaping of messages
Not calling an explicit output format defaults to ->escaped(), which often
leads to double escaping.

Spotted by the phan-taint-check-plugin.

Change-Id: Ie527768bea670808e63cfc8cbff64015ae29d4a3
2018-09-03 22:58:45 -07:00
jdlrobson cd528e120b Client side error reporting for Minerva+MobileFrontend
This adds a client side error logger that will store errors
in EventLogging. We will use it to get a sense of the number
of errors inside mobile.

To enable make use of the new configuration variable
wgMinervaErrorLogSamplingRate = 1

Notes:
* the optional `meta` field will not be utilised by the generic
error handler.
* URI length is not trimmed for title. We will consider whether we need
to make any adjustments to the schema values during roll out.
** For stack trace, we limit the length by removing errorUrl (which is logged
separately)

Testing:
Add throw new Error('asasasa'); anywhere in your code and make
sure the code executes. It should trigger an Error event provided
that configuration has been updated.

Bug: T202026
Change-Id: I07f01b4c025b2e5e4cbf88ec05e7c536442c62cc
2018-08-30 14:35:27 -07:00
jdlrobson 0acfda1931 Don't send NaN as a value for sectionNumbers
The keyword "all" was being parsed as an integer incorrectly. To avoid this

Bug: T202940
Change-Id: I5553a4bb50cd7639c879f2c6e812fba25a216175
2018-08-28 18:26:09 +00:00
Zoranzoki21 6d877928f5 Fix common typos in code
Bug: T201491
Change-Id: I1b31983069a45ff6c0493f370596351a407f6a87
2018-08-27 20:54:16 +00:00
jdlrobson 40eca4e3f3 Hygiene: IssuesOverlay moved from MobileFrontend to Minerva
The CleanupOverlay is moved to Minerva and renamed the
IssuesOverlay to be consistent with current terminology

The new IssuesOverlay is defined inside the module
skins.minerva.scripts to which it now belongs.

Additional changes:
* various file renames
* overlay-cleanup renames overlay-issues
* cleanuptemplates renamed issues.js
* Add a test stub file to avoid the need to load templates inside
the test environment

After this change, I75f47622d94e504688e04dfb2892540473817053
should be merged to avoid confusion.

Change-Id: I08945a324a6b878abe56efed1e988466085b3018
2018-08-16 14:06:12 -07:00
Jan Drewniak a0071643d3 Disable edit icon in read-only mode
When a wiki is in read-only mode, the edit icon on articles should
not open an editor. Instead, it should be in a "disabled" state and
inform the user that the wiki is in read-only mode
( i.e. show the "apierror-readonly" message).

Bug: T197497
Change-Id: Iee1414c20bea3ca936fb807820e58e5ed566d008
2018-08-15 19:40:09 +00:00
Stephen Niedzielski 22b2f0fd7c Hygiene: move page issues A/B test logging to file
Refactor the page issues A/B test logging implementation to a distinct
new file that only has the responsibility of tracking.

T191528 is referenced in this commit as I was having difficulty
answering the feedback and bugs reported in the current implementation
without working through and restructuring the flow as I understood it.
This refactor is merely a byproduct artifact of that effort to focus on
the parsing and presentation responsibilities.

Bug: T191528
Change-Id: If547a0a67fbc9a532f834fe374abf668309e73df
2018-08-14 20:49:06 +00:00
Stephen Niedzielski a905b1c161 Hygiene: replace header and content divs
- Replace the header div with a header element and the content div with
  a main element. main and header elements are already shivved:
  https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/22dd581f10/resources/lib/html5shiv/html5shiv.js#234.

- Link the wiki header title / logo to the main page. Note: the link
  border around images is already omitted. The link is identical to the
  menu home button.

Bug: T198947
Change-Id: Id312638d86179e75bc670e72e5943f8c00232bbb
2018-08-10 20:44:14 +00:00
jdlrobson 9644e5372b Add tests for page issues code
Bug: T191532
Change-Id: I5291b51ec32ab95ff1ec41e50b84fea4567f28cb
2018-07-31 11:42:09 +00:00
Bartosz Dziewoński f114f81d42 Remove fancy block info popups (move to MobileFrontend)
We only used them for registered users, but MobileFrontend's
EditorOverlay code can use them for anonymous users as well.

Remove code for looking up block details in wgMinervaUserBlockInfo,
now we only care whether the user is blocked at all to display a
different icon. MobileFrontend looks up the same information via API
already.

Remove unused message 'mobile-frontend-editor-blocked-info-loggedin',
it was only used by non-fancy popups, which were removed in favor of
the new ones in f51cf7db7b.

Bug: T193754
Bug: T198765
Depends-On: I80564c3e6e2d0f4d7eae754f206780fb4054f254
Change-Id: I64be24845b4fee76d6b4a8e481a218f2160fced6
2018-07-26 23:44:28 +02:00
Stephen Niedzielski 69ffc0b988 Hygiene: remove IE8 menu hack
Remove JavaScript hack introduced in
MobileFrontend 858a66d9f.

This hack is already provided by html5shiv.

Change-Id: I09251a23f4c0dda2f971028fa0250335bfe998b4
2018-07-23 02:45:30 +00:00
Stephen Niedzielski d2f6c38fe7 Update: page issue icons
- Fix a bug where the all issues endpoint would incorrectly collect
  issues from all sections.

- Update the page issue iconography. This increases the size of the
  delivered code and images by 1743 B minified uncompressed according to
  mw.inspect() (from 16.4 KiB to 18.1 KiB).

- Add support for identifying page issue severity based on template CSS
  classes.

- For multiple issues templates, show the highest priority icon.

Bug: T191528
Change-Id: Ie0a4c83ec7cfb856ec581d058797109746e3cb99
2018-07-17 15:54:17 -05:00
Bartosz Dziewoński 10fa5f0c55 Remove unnecessary MinervaResourceLoaderParsedMessageModule
All of the uses are unnecessary or harmful:

* 'skins.minerva.toggling'
  This module has no messages, parsed or otherwise.

* 'skins.minerva.editor'
  * 'mobile-frontend-editor-redlink-explain'
    This message has no formatting to be parsed. In the past, it
    included the '{{SITENAME}}' magic word, which is still present
    in some translations, but it is supported by the client-side
    jqueryMsg parser anyway.

  * 'mobile-frontend-editor-blocked-info-loggedin'
    This message only uses '{{GENDER}}', which is supported by
    the client-side jqueryMsg parser. More importantly, it uses
    a parameter for it, which is actually not supported by
    MinervaResourceLoaderParsedMessageModule. The message would
    always use the default gender, regardless of the parameter.

Change-Id: I0c597febf9051670228dd144b53521a121f3a220
2018-07-10 02:29:33 +02:00
Bartosz Dziewoński a2dcc8124f Remove incorrect code comment
This was copy-pasted from the function above and it is not true here.

Change-Id: I0513d46789405ea2e6d1cdb619cc548ab8e9ef2b
2018-07-10 01:24:30 +02:00
Stephen Niedzielski b60fab3331 Fix: add login icon as a server render dependency of main menu
The profile icon is necessary for logged in users. This is known when
parsing skin.json but was not added in MinervaHooks.php. This patch adds
the dependency unconditionally although it is only needed for the server
render of Special:MobileMenu for logged in users.

Bug: T196893
Change-Id: I2a8485299162c01d28ca1b07e7071ad0c0ef44fc
2018-06-29 00:24:36 +00:00
jenkins-bot 6037e61bc9 Merge "Revert "Suppress display of wikitext editor on action=edit"" 2018-06-22 19:23:37 +00:00
Bartosz Dziewoński 645ffa46f8 Revert "Suppress display of wikitext editor on action=edit"
This reverts commit b8c0e4ff30.

Bug: T196915
Bug: T197834
Change-Id: I875854ab65f8b76929285938d2dbaa996caf3546
2018-06-22 19:11:13 +00:00
jenkins-bot d5cd6950b0 Merge "Suppress display of wikitext editor on action=edit" 2018-06-20 09:45:57 +00:00
jenkins-bot 041eaadcb5 Merge "Mobile page issues - visual styling changes" 2018-06-19 22:13:31 +00:00
jdlrobson a231525112 Mobile page issues - visual styling changes
Changes:
* Introduce Jan's beautifully documented $wgMinervaABSamplingRate
Set to 1 to A/B test 50% of the population
* Split out ambox template styles into a separate file referenced
by hacks.less
* Update cleanuptemplates setup script to consider two buckets

Test pages:
* Shqiponja_Partizane
* World_War_II_in_Albania
* Liberation_of_Tirana
* French_Consulate
* Abd_ar-Rahman_IV
* M109_howitzer
* Aimoin
* Transport_in_Brazil
* Transport_in_Cape_Verde

Bug: T191303
Change-Id: I8d11e655ccb847b7999e64dda57b225ad8b1c23a
2018-06-19 14:11:19 -07:00
Legoktm b56e82c8a8 Revert "Allow type Language for $lang of doEditSectionLink"
This reverts commit 648491015c.

Parent patch is being reverted since it didn't follow the
deprecation policy.

Change-Id: Id0e80bf23593d6fc7c986df7b42ff836cc24d867
2018-06-19 01:35:19 +02:00
Fomafix 72a4f7cf4c Add missing return in doEditSectionLink
Change-Id: If2bfae229c2d12090276a5f8dea00a45746349a6
2018-06-18 21:33:03 +02:00
jenkins-bot 927b1bddd2 Merge "Force type Language for $lang of doEditSectionLink" 2018-06-18 01:14:35 +00:00
Stephen Niedzielski 3485269be1 Update: add internal and revise external link icons
Bug: T190549
Change-Id: Iad7fdc2f2a730fa8874487c0d83355f21a0bf7ea
2018-06-15 12:31:42 -05:00
Fomafix 152f48b846 Force type Language for $lang of doEditSectionLink
wfGetLangObj() is not necessary anymore.

This change increases the requirement to MediaWiki 1.32 or higher.

Depends-On: Id49201957e716ef8a2ea930b3616ca4fe6e35633
Change-Id: I18adeebe476b321546ceda43eb12b6cf7e8081b3
2018-06-14 23:36:39 +00:00
David Lynch b8c0e4ff30 Suppress display of wikitext editor on action=edit
As I6c7e3443756fd72749964d1eda37e3d123b201b3 gives full-page editing on
action=edit, suppress the display of the original wikitext editor so there's
not a flash of a different editor before the overlay appears. Provide a
fallback so that in cases of no-JS the wikitext editor can still be reached.

Bug: T196915
Change-Id: I7dd3de984ead4d70e977e5607bb07606d341db54
2018-06-14 11:57:18 -05:00
Jan Drewniak 7617174d40 A/B test bucketing wrapper for page issues AB.
Provides a class that initiates AB-test bucketing and registers
as a MF module. Activates the reading depth test for users who are bucketed
in either buckets "A" or "B".

Does not add event-logging or visual style changes for page issues AB test.

Bug: T193584
Change-Id: If8504a35059c6d1b056cef063a595b1c2ffd351a
2018-06-13 15:43:08 -07:00
jenkins-bot 92a6e01791 Merge "Provide gender parameter" 2018-06-06 08:22:36 +00:00
Piotr Miazga 52e8e93020 Provide gender parameter
Bug: T194868
Change-Id: I20fb6aee13c6bf7bc66bf3cae9560548a336e04d
2018-06-05 16:40:11 +02:00
Fomafix 648491015c Allow type Language for $lang of doEditSectionLink
wfGetLangObj() allows type Language already.

Change-Id: Ibe295e7020e995eea52e319feaf59c635f8bb4dc
2018-05-30 14:40:25 +00:00
Timo Tijhof 64134bd8a6 Remove minerva.less from global import path
Use local imports instead given all relevant files are within the
same repository, and don't vary by configuraion.

Bug: T140807
Depends-On: If3edac9a35b346af0320c12f70c0d978a6346201
Change-Id: Ife3cc345a63aff452e93accbe0a593fbaa358732
2018-05-29 12:19:00 +00:00
jdlrobson f7e8df65b2 Merge profile icon with user-avatar icon
Both are the same but different variants - so use the variants
ResourceLoader module to keep this modules consistent in color
and form.

Change-Id: Ib75e1ff741fa46ad9698e89c4433b6edbad4d376
2018-05-08 23:35:44 +00:00
David Barratt f51cf7db7b
Use a Drawer for Block Notices
When a user is blocked, the toast message provides insufficent information to
the user. To provide more information, as well as a better design, the block
message will be moved into a drawer.

Bug: T165535
Change-Id: Ib025db3a8a4d1fd7bd05b69f9b5326943288372f
Depends-On: I926918d0bd7f2176f188a2154dc5e99f6a8a7ad1
2018-05-08 13:20:00 -04:00
jdlrobson 6267ac8ca0 Override 'core' styles for Minerva
Minerva purposely does not load mediawiki.legacy.shared
This should still be the same when setupSkinUserCss is
deprecated.

Change-Id: Ib2b19ba165a9d646a770702cdf1724509156b93e
2018-05-04 23:41:56 +00:00
jdlrobson e2d72f4ba1 Dequeue render blocking styles
The change in If9c8f0974e3a4b08e4a66d37f7f5adf67d73054e
will introduce styles that are incompatible with Minerva due
to the blanking of the content array. The styles content
array should also be blanked.

Bug: T42812
Change-Id: I3388c3c4f91cdbab11e89cdc95973b688d3f1ce7
2018-04-26 13:04:04 -07:00
jenkins-bot 9007208281 Merge "Hygiene: Document that insertWatchlistMenuItem doesnt work for anons" 2018-04-20 20:32:47 +00:00
Kunal Mehta f5b9a5d64c Let special pages redirect to the login page themselves
SkinMinerva::getPersonalUrl() is supposed to link to the login page if the
user isn't logged in, building a URL that will redirect them back to the
proper special page. Except the two special pages that use this function
will already automatically redirect to the login page if you're not logged
in.

Manually handling the redirect requries additional complexity, and
duplication of things like message keys.

Change-Id: Id5bfca1049f84e52476b179b8fdda50d030d7c1c
2018-04-20 01:11:40 +00:00
jdlrobson c4b28af2c3 Hygiene: Document that insertWatchlistMenuItem doesnt work for anons
Follow up to Ic729992db4db459044a239ec34d95e56b013841d
Change-Id: I1de8f8f527fb5f84d7f080eb5d81298bae3b48b3
2018-04-19 17:40:19 -07:00
Kunal Mehta 892adf0ea7 getUser() will always return a User object
Change-Id: Ic729992db4db459044a239ec34d95e56b013841d
2018-04-20 00:37:06 +00:00
Kunal Mehta 9fc58af509 Get rid of ICustomizableSkin
As far as I can tell this interface is entirely unused.

Change-Id: I9f2ff27ab0e7f9f1e842d5e073eed5d9428f3cda
2018-04-20 00:22:48 +00:00
jenkins-bot 1ccaa51ca8 Merge "Use ExtensionRegistry to detect whether Echo is installed" 2018-04-20 00:08:48 +00:00
jenkins-bot 4161d01409 Merge "Remove unused variable" 2018-04-20 00:03:37 +00:00
Kunal Mehta 3917d74778 Use ExtensionRegistry to detect whether Echo is installed
Change-Id: I7816983c132c45653666b294fec2ee64fac94944
2018-04-19 23:59:45 +00:00
Kunal Mehta 4ba5b9167f Remove unused variable
Change-Id: I7a4a38a8f7dc6e5b4d24acd5d171a1a5310b2260
2018-04-19 23:58:54 +00:00
Kunal Mehta f3def0b8d2 Take advantage of Title::isSpecial()
Change-Id: I0c5dbec63cdd109bd99d6a6fdd9c6dd1da182bd4
2018-04-19 23:58:09 +00:00
jenkins-bot 8bd72dc871 Merge "Remove @return bool from hooks that don't return anything" 2018-04-19 23:24:04 +00:00
Kunal Mehta 508ae30ea5 Remove @return bool from hooks that don't return anything
Change-Id: I21dcfdb63f0e84dfaee4e075eb26e0d5a6bf3f73
2018-04-19 23:17:20 +00:00
Kunal Mehta 90ed6468e2 Split MenuEntry to its own file
Change-Id: I2114141bf8f6d67671e063fae8c44044184688bd
2018-04-19 23:16:55 +00:00
Kunal Mehta 4da5567bd9 Simplify SkinUserPageHelper constructor
Instead of requiring a full IContextSource object and only using the
Title, only ask for the Title in the first place.

Change-Id: I33034193140ca53919f29f847a03caf26250ce54
2018-04-15 16:38:50 -07:00
Kunal Mehta 04e61303c2 Add GPL file header to PHP classes
Change-Id: I2333507372c67ffb8e83777ca6f554aed690de9c
2018-04-15 16:23:10 -07:00
Kunal Mehta 1b1c56c862 Fix some file names to match their class names
Change-Id: Ib1a12f8073a2d737c40c0b4d1dd64f9e55738019
2018-04-15 16:12:45 -07:00
jdlrobson 2e453edd23 Only load notification icon (bell) CSS for logged in users
* The notification-count style is only needed if you are logged
in. Given a small percentage of our users are logged in, we
load a lot of render blocking css unnecessarily.
* The bell icon is not needed for anonymous users so pull that
out from skins.minerva.icons.images which is loaded for all users
into a module only used by logged in users (skins.minerva.icons.loggedin)
* Simplify the user-button rule - it is overly specific - probably for
historic reasons.

Additional changes:
* Simplify isAuthenticated helper

Change-Id: Ia72e7e45d276e8aac1ff5471bf6158705c7b5f99
2018-04-12 09:27:01 -07:00
Jdlrobson 4335114fca Revert "Fix: check if user is blocked to show edit button"
The merged patch hid the edit icon completely for blocked users.
It should not do this but should show. I've updated the task
description to explain this behaviour better.

This reverts commit cb6bde03dd.

Bug: T190834
Change-Id: I28b2a6bfb1d0501668752faaf4cbd2ea8bf3398a
2018-04-05 22:23:58 +00:00
Stephen Niedzielski cb6bde03dd Fix: check if user is blocked to show edit button
Before showing an edit button, check that the user isn't blocked from
editing everywhere. Note: User.isBlockedFrom() internally checks whether
that includes user talk pages or not.

Bug: T190834
Change-Id: I9126dfef04333e15baa67e1d080b09f35548d58d
2018-04-05 22:02:40 +00:00
jenkins-bot 68df48ddf0 Merge "Convert custom LESS var from global to local" 2018-04-02 23:41:18 +00:00
Timo Tijhof ba0419fcbf Convert custom LESS var from global to local
Avoid the 'ResourceLoaderGetLessVars' hook, which registers a
global LESS variable exposed to all modules (inc. core/extensions).

Instead, use a FileModule subclass to provide the variable only
to the modules that need it.

Using this approach, also has the benefit of being tracked by
the version hasher, so that changes to the configuration actually
result in timely invalidation of module caches.

Bug: T171367
Change-Id: I7c7d13c83004edfc852a9b7dbfc4169617ab9f64
2018-04-02 23:28:58 +00:00
Stephen Niedzielski e8b4559f5b Fix: always show table of contents
Do not conditionally render the table of contents. Note: the underlying
condition, MFTOC, appears to still be used by MobileFormatter so it was
unchanged.

Bug: T189699
Change-Id: I7088ccad75c2a8504bf435418d7dd62238b2135d
2018-03-28 13:36:17 -05:00
Zoranzoki21 441f5ac89d Remove unused $useHeadElement property from skins
Bug: T190575
Change-Id: I1ff60f683ba7186343408579d72303fc693b5a87
2018-03-27 17:18:53 +02:00
jdlrobson cfd5fbbde8 Add icons for all the types of issues
More hackery!
This adds some tests and ensures that our own icons are mapped to the
existing template icons.

Bug: T187916
Change-Id: I49073f22995c6730369235d6039939915ba2079c
2018-03-15 15:02:05 -07:00
jdlrobson 888129478b Generalise search trigger mechanism
Allow content to trigger it.

Bug: T189316
Change-Id: Ie9a66b001b3ea4f79e465747b80b181df948cd34
2018-03-12 20:49:25 +00:00
jdlrobson 196fb20836 Restore Minerva specific userpage styles for all user pages
In T182162 these were removed incorrectly. They should only have
been partially removed.

Bug: T187222
Change-Id: Ia3fb34250714fe4ccb10c32a7027fda167e06a16
2018-02-13 16:14:54 -08:00
jdlrobson fa27cf8a0d Merge remote-tracking branch 'gerrit/specialpages' into T182217
(Depends-On I535b24803341dc3912aed4bef06970e2861fe3ad)

Change-Id: I3fc50739415686032683c421008e832e785e1651
Bug: T182217
2018-02-06 21:39:22 +00:00
jdlrobson 97136f9d63 Prepare for breaking change to MobileContext
With the introduction of the FeaturesManager the
getConfigVariable method will disappear.
(I535b24803341dc3912aed4bef06970e2861fe3ad)

That change cannot be merged until Minerva stops using the
method.

This temporary fix ensures it resolves to false when the method
doesn't exist.

Bug: T182217
Change-Id: I619fd8fac47a98d1ff8f3646d61b8e285246a17f
2018-02-05 13:15:34 -08:00
jdlrobson 3047f3e0fa Merge remote-tracking branch 'gerrit/master' into specialpages
Change-Id: I1bc48ac546865f515df65e9d7f0c75e7f5c6d684
2018-02-01 11:35:11 -08:00
jdlrobson 20f69d0b49 Do not add non-existent skins.minerva.special.preferences.scripts
This module does not exist.
Don't pretend it does and add it.

Bug: T185934
Change-Id: Iefef261fdac2c513e5ee278e94574026601f76f9
2018-02-01 00:33:48 +00:00
jenkins-bot af9db025df Merge "Remove horizontal line from popups preview in MinervaNeue skin" 2018-01-30 19:18:58 +00:00
Alangi Derick 3c81e0c717 Remove horizontal line from popups preview in MinervaNeue skin
A horizontal line shows in popup previews in the MinervaNeue skin
just above the setting icon due to a css rule that affect all footer
elements. Removing this effect to apply only for the MN skin.

Bug: T184560
Change-Id: Idb0c40c3fc24e4ec2d32cb2de9520952448da77a
2018-01-30 20:06:42 +01:00
Timo Tijhof 08985b2229 Remove use of QuickTemplate::setRef
Follows-up 2c01147c13be, 429f557cc7f68a46.

The array is already copied by value once returned from getLanguages().
Setting it by reference within the QuickTemplate instance doens't
have any effect, but does logically break the concept of pushing
data in a single direction through the skin.

Remove use of setRef in preparation for restricting skins only
consuming data as given, without the ability to change data
in other parts of the system.

Bug: T140664
Change-Id: I0978dd5c123fda57f45534a8d2e51b7e65e55223
2018-01-27 13:11:37 +00:00
jdlrobson c5d09c0288 Prefix icons in Minerva
Changes:
* MinervaUI will now prefix any icons with `minerva`
* Update definitions in skin.json, retaining selectors for cached
HTML for icons that are rendered via PHP.
* In I9021c53c2c04bdd7ce395eed33d89986acbfea6d watch and watched
and arrow are moved to MobileFrontend so are removed from the RL module
skins.minerva.icons.images.scripts as they are not
used directly in this repo. user and anonymous are no longer used
so also removed.
* Presentation of userpage now belongs to MobileFrontend. Icons
are styles were moved there in depends on. They are retained in
skin.json to support cached HTML as user pages are subject to
cache. They can be removed in a week.
* In code review we noticed the anonymous icon was badly named. We
rename to login. No caching implications.
* Main menu icons are now prefixed with minerva rather than mf to
reflect where they come from.

Depends-On: I9021c53c2c04bdd7ce395eed33d89986acbfea6d
Bug: T182162
Change-Id: I93264024f4915fc910c792b1905b89cdc6b8b546
2018-01-19 15:30:03 -08:00
jdlrobson fe3ac29fe7 Merge branch 'master' into 'specialpages'
Change-Id: I167f03477fd79e5ea0c7fa5cdf5df71bb8da31c2
2018-01-19 11:00:55 -08:00
petarpetkovic 413fcc12f6 Fix seen notifications appearing as unseen on mobile
Important note: Make sure to distinguish unseen from unread

One way to reproduce minerva and non-minerva notification inconsistencies:
- Have all your alerts and notices seen. This is displayed with grayed out
number on vector skin or no number at all, if you have (marked as) read.
- Generate new alert or notice (one is enough) in your preferred way.
- You can check minerva and non-minerva at this step. Both should be in sync.
But don't perform any additional action.
- Open the notification popup in some non-minerva skin (I have tried with
vector and monobook), marking it as seen.
- Check the notification icon in minerva. At this point, you should see
notification displayed as unseen.

The reason bug appeared in the first place is that alert/notice timestamps
were mixed up when seen time is obtained. We get seen time from
EchoSeenTime class, where we get smaller of the two timestamps,
using PHP method `min()`. See I27109ee6a248. Then, we get last unread
notification timestamp (which can be either alert or notice), and compare
that to seen time. That leads to the situation when you have only one of
alerts or notices with unread items, smaller timestamp is used for seen,
and most recent for unread, at which point we compare timestamps for
two separate things.

Previous behavior of getting seen timestamps (using max instead of min) would
probably solve the problem, but some other inconsistencies might arrise.
This should prevent any weird and unpredictable behavior to happen.

Bug: T183076
Change-Id: I20bbd6c590086b1c3eccf82983aad59eb3144a7a
2018-01-18 14:18:56 +01:00
jdlrobson dede844830 Minerva should use FeatureManagers class
Bug: T182362
Depends-On: I6cc4a2ebcd75c054294daf329d94d35a02e50f8e
Change-Id: I6ba5bf49b9060c31ad2224a437072b3426a45619
2018-01-09 14:38:33 -08:00
jdlrobson 09a1f98ab3 Merge remote-tracking branch 'origin/master' into HEAD
Change-Id: Ia1a520d983be096e29cfe725f619be0423f9d110
2018-01-08 16:37:44 -08:00
petarpetkovic c8195e37ef Fix notifications always appearing as unseen
After Ie92b223a48 removed $flags parameter from EchoSeenTime::getTime(),
we got 0 as $format passed to the method, which caused mismatch in
timestamp string formats when comparing to $notifLastUnreadTime timestamp,
which caused notifications to appear always as unseen (although that's
unpredictable, because of wrong format used).

Bug: T183076
Change-Id: Ia4ff0bc4c3b7ed80b5a22a9ca0052f1909469180
2018-01-03 18:21:40 +01:00
jdlrobson 6598c1e7c3 Merge branch 'master' into HEAD
Change-Id: I220fbc57ee20d2a6717b39dba809401de2207ce0
2018-01-02 13:21:27 -08:00
David Sn 90f324a5b7 Use preg_replace instead of str_replace for replacing extension
Bug: T166684
Change-Id: I233be410486276f30b08034180eb54cb08e04076
2017-12-07 16:05:48 +00:00
jdlrobson c986db6c0e Always render taglines unconditionally and update styles
Adjust tagline margin per Nirzar:
https://phabricator.wikimedia.org/T180095#3801719

Note, this will  enable the tagline everywhere.

Change-Id: I3bce2a3472ab2e53261965c953572f35cc740eed
Bug: T180095
2017-12-05 00:27:11 +00:00
David Sn 8a19c0cb33 Use png as fallback for svg on non-supported browsers
This will use the srcset attrribute which was introduced with HTML5,
in order to load the svg image on supported browsers.

Should fix the bug after merging change 394820.

Bug: T166684
Change-Id: I2337b750c80e79c816dc817dfe230e063eed0345
2017-12-04 22:13:23 +00:00
jdlrobson eaa4dae5af Disable download button in all namespaces except main
The MinervaDownloadIcon config option is replaced with a
more specific wgMinervaDownloadNamespaces config option.
If the list is empty then the download button will not be
shown.

Since the download icon is enabled everywhere in production now
this is good as it means Minerva reflects the production value.

Bug: T181152
Change-Id: Id78c1de9e8e9013530106bc0d45d3cf0297897b5
2017-11-29 20:29:12 +00:00
jdlrobson ed5e9dd1d5 Hygiene: Refactor Minerva history link generation
* Create several sub functions to manage complexity of the history link
* Clean up MinervaTemplate to use data directly and remove isMainPage
template variable which is no longer being used.

Change-Id: I124aec9637f3635a335c58e559e578b2a56eb4c5
2017-11-27 14:27:11 -08:00
jdlrobson b72c10e06f Show last modified bar without relative time for old revisions
If FlaggedRevisions is being used then older revisions will be
shown as if they are the current revision of the page. This causes
problems as it makes it hard to give a true indication of when
something was last modified - do you show the last time someone
made an edit or the last time someone approved an edit?

The same issue applies on revisions and we attempted to fix this
earlier in T153125 but in doing so caused this problem.

Bug: T180116
Change-Id: I6d47adf272c99791d4af9f97afa02799d495887e
2017-11-22 10:29:51 -08:00
jdlrobson b05da8d49d Load all images during print action
When the print button is clicked, load all images from the page
before calling window.print

Add a timeout to make sure the user doesnt wait too long.

Change-Id: Ie922d239f9c5b5757237dc10b673fb500ff203ad
Depends-on: Id7f21606be3db22fe8dfde2db675f9905547cfea
Bug: T180058
2017-11-21 15:27:36 -08:00
jdlrobson 8eb65b264d If timestamp is null load revision time
Passing null to wfTimestamp will result in the current time.
Protect against that happening

Bug: T180103
Change-Id: I6ef9577bf52609bf387b0146f1d8a4a53be58cd7
2017-11-16 23:23:25 +00:00
jdlrobson e422eb9a81 Do not try to add edit links to the HTML in contexts without a Title
Title may be null when accessed via this->getTitle()
If this is the case we should assume the skin is being used by someone
who is not a reader and in these circumstances, not try to render any
page actions.

Bug: T179833
Change-Id: Ia47fd9b059101bf22b5d31be7df3a332b35d6b24
2017-11-09 21:23:48 +00:00
Kunal Mehta 74b3faf580 Move class_alias out of skin initialization
Use the standard way of doing it by adding an autoloader entry, and putting
the class_alias() call into the same file as the class.

Change-Id: I93e19ebcf3dd7d9815623de5e24861949fd0269a
2017-11-08 00:20:00 +00:00
jdlrobson dfabc67d95 Hygiene: Remove dead call to addModuleStyles
This is adding an empty array and not necessary

Change-Id: I232dd9b0fe7343a6531582ad66a62d3babe275e3
2017-11-01 11:20:17 -07:00
jdlrobson d3318a9f85 Remove MobileFrontend's font changing code from Minerva
Fontchanger code now runs on all skins under the `mobile` target.
All the code will now live in MobileFrontend meaning developers
can operate inside one code base.

Depends-On: I857cfe2d9be9fe49c04c860bc234384c787239b2
Change-Id: I2759455cb6d7ddf13798e94452cb74baf502bafe
2017-10-30 19:11:16 +00:00
jdlrobson 12b49a70ad Notification icon should not show NaN for persian Wikipedia
Bug: T172755
Change-Id: I2884c8daed3fe0e0d05c746ec6319956b7426957
2017-10-26 20:27:12 +00:00
jdlrobson 45a1b3b423 Add feature flagged DownloadIcon
Shortcut for print. Disabled by default and controlled by
wgMinervaDownloadIcon

Note that with lazy images enabled, images will not appear
in the printed article. This can be easily addressed inside
the onClick function in a later patchset with a few modifications
to the Skin class.

Currently the flag when enabled will show on all browsers. There
are some open questions on the ticket about how we want to limit
the feature. This shouldn't block review or merging.

Bug: T177215
Change-Id: I49f1736870c743990b3fb9916247e07a597b2f59
2017-10-23 18:12:20 +00:00
jdlrobson b93b7eda7c Render add discussion button in PHP not JS
The talk page JavaScript progressively enhances an
existing button in the page.

Remove the frontend logic and rely entirely on whether
the button is in the page or not.

Additional change:
* The browser tests incorrectly suggest a user needs
5 edits to be able to use the talk feature. This is not
true. They just need to be logged in. Update that logic.

Bug: T167728
Change-Id: Iacedea30bdd0775b3d785db5b143abafd7a18b39
2017-10-16 22:35:11 +00:00
Umherirrender 8e8c9d0654 Improve some parameter docs
Change-Id: I239d4aa0023978b27bc04a7ff7d55892f3bb7feb
2017-10-05 19:17:38 +02:00
jdlrobson 2e8ea6219f Update SVGs for page actions and restore locked edit icon behavior
The locked edit icon will now show on protected pages.

Additional changes:
* userpage and userNormal was not minified. This has been fixed.

Bug: T174105
Change-Id: I0ef9c4cf3ea6cd1c550023fdf99581b665b459b2
2017-09-29 13:20:39 +00:00
jdlrobson 0dd994edda Prepare to break the server side MobileFrontend dependency on Minerva
Changes:
* Minerva now maintains a MinervaUI - a simplified version of
MobileUI that provides iconClass and buttonClass helpers.
* Minerva now maintains its own ResourceLoaderParserMessageModule

Remaining issues:
* Main menu links to '#'
* Unknown dependency errors are thrown due to the missing
JS libraries e.g. mobile.watchstar
thus JS based UI components are unusable e.g. search autocomplete,
and edit button
* Language button navigates to a missing special page without
MobileFrontend (see T104660)

Bug: T169569
Change-Id: I89e2e15faabab73b0cba91afc2f2c5e785edef29
2017-09-27 21:21:59 +00:00
jdlrobson 606e72ab68 Revision::newFromTitle may return null
Bug: T176882
Change-Id: I9aea25c2db81a12f16414edcb279f3241dc380bc
2017-09-27 19:58:46 +00:00
Kunal Mehta 69a94b27c3 Use 'remoteSkinPath' for qunit tests
This isn't in an extension anymore :-)

Bug: T175863
Change-Id: I7d8846d0eb0f92c2e419a1e1b76e94ae19ff1137
2017-09-13 23:45:10 -07:00
jenkins-bot 0a3378adcf Merge "Hygiene: Refactor SkinMinerva so it doesn't use MobilePage" 2017-09-08 19:17:58 +00:00
jdlrobson 9909914b30 Hygiene: Refactor SkinMinerva so it doesn't use MobilePage
MobilePage is provided by MobileFrontend and replicates functionality
in core. Let's invest more in those core interfaces. It's a bit of a
maze, so I think there's probably a cleaner way of doing this...

Change-Id: Iea0a3121841c4774eb117168b1cfc8c2e1e24a0c
2017-09-08 14:50:25 -04:00
jdlrobson 69cb08262a Hide last modified bar on old revisions
Bug: T153125
Change-Id: I43f6f1993ebeacead12d7ec6da584c6d1e14da12
2017-09-07 14:17:30 +00:00
libraryupgrader f86c148866 build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
The following sniffs are failing and were disabled:
* MediaWiki.Files.ClassMatchesFilename.NotMatch
* MediaWiki.Files.OneClassPerFile.MultipleFound

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment.SpacingAfterParamType
* MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage

Change-Id: I0689ff20133a2a23d6389aa50487349c6ed3797b
2017-09-01 05:01:10 +00:00
jdlrobson c323c6858a Hygiene: Merge skins.minerva.print.styles with skins.minerva.base.styles
We no longer need to keep this as a separate entry point now we do not
feature flag our print styles

Please enter the commit message for your changes. Lines starting

Change-Id: I6bf12980aa929e84f239931beb0a505809231830
2017-08-31 19:09:03 +00:00
jenkins-bot c5139c3536 Merge "Avoid using deprecated Title::canTalk()" 2017-08-30 17:23:07 +00:00
Kunal Mehta ff3f980f70 Avoid using deprecated Title::canTalk()
Change-Id: I9f43710bed8557d192906b49fbc8a8f9e43d3448
2017-08-29 12:37:00 -07:00
jenkins-bot 7c1be417b0 Merge "Remove special page resource module handling" 2017-08-28 16:21:52 +00:00
jdlrobson ac7fcfc9e1 Disable wikitext editor on non-wikitext content models
Do not allow editing via JavaScript on non-wikitext content models
For these pages ?action=edit will be used

Bug: T173800
Change-Id: Ic62a0c1397ab8a6a59e5382c2999b63b3c60a19f
2017-08-22 17:02:58 +00:00
jdlrobson 61ba76efdb Remove special page resource module handling
This is handled by MobileFrontend now, just as it should do.
We rely on skinStyles where possible.

Depends-On: I665f6fe60939475249786fdc951149c38473fda6
Bug: T173597
Change-Id: I0fe9efcf98bbd8e188d91a29d4cfda897d47808d
2017-08-18 19:37:08 +00:00
jdlrobson d5e09c91e9 Check if SpecialMobileWatchlist exist
If MobileFrontend doesn't exist this will throw an error

Bug: T171241
Change-Id: Ie61cfa61b78a53598ac59aea15c8a4e6a261238d
2017-08-17 22:40:54 +00:00
jdlrobson 5146a90590 i18n: Add Minerva specific message key for last modified bar
This is currently defined in MobileFrontend which uses it for
Special:MobileWatchlist.

We shouldn't use two messages for 2 purposes so let's give it
its own dedicated message.

Change-Id: Id5df6aad20815b88b8bd2685514e7eb3237a5b3b
2017-08-16 14:56:00 -05:00
jdlrobson 65670fbce3 Do not assume MobileFrontend special pages exist
If they don't exist attempts to use them will throw errors.
This will only happen if MobileFrontend is not installed

Change-Id: Iee674011bbd59d79914a144d1738b912eceea6b1
2017-08-16 14:34:26 -05:00
jdlrobson e1ee63d4af MobileFrontend should be responsible for adding mobile.site module
Change-Id: I4508762629333c96dc6b11f6c0f63b675b367209
Depends-On: I094a57532a4e7dac47d06f25c56dbd4935ec707c
Bug: T171062
2017-08-11 11:44:49 -05:00
jdlrobson f4ec2330e2 Don't output empty footer items in desktop Minerva
These fields can be false. Make sure we don't output them

Change-Id: If40c27f85e61558d09b14f4f4cfe394f581929b5
2017-08-04 07:51:48 -07:00
Eddie Greiner-Petter b0384c4314 Show title on the page named '0'
The string '0' evals to false in the if( $pageTitle ) condition, hence
the title was not shown for the page named '0'.

Bug: T163084
Change-Id: I27ab379bf67634c484c4cf5e12e391d69702f464
2017-07-30 19:50:34 +02:00
jenkins-bot 78daa06cc1 Merge "Hygiene: Drop MFAllowNonJavaScriptEditing and Special:MobileEditor" 2017-07-26 18:40:09 +00:00
jdlrobson 3ad9c4e3c6 Hygiene: Drop MFAllowNonJavaScriptEditing and Special:MobileEditor
Bug: T125174
Change-Id: Ifc0efcb87605e5cd678343d1ac91a2ce53b33664
2017-07-25 11:07:03 -07:00
Umherirrender 2aacf47c8d build: Updating mediawiki/mediawiki-codesniffer to 0.10.1
Change-Id: Icba559465885af1169a1912f501bed56eea23ad9
2017-07-24 18:53:04 +02:00
Piotr Miazga 6819b6e163 Hygiene: Use ExtensionRegistry to manage skin dependencies
Changes:
 - removed MobileFrontend existence check from MinervaHooks
 - added MobileFrontend as a requirement inside skin.json

Additional benefit: Skin will work only with MobileFrontend v2.0.0
and higher.

Change-Id: I1f2f5de3dbc0cf5159a06bc8f47e1cf401a2fcdb
2017-07-24 15:58:21 +00:00
jenkins-bot bd898e2be4 Merge "Minerva should use mediawiki.hlist" 2017-07-21 18:47:35 +00:00
jdlrobson 47546207ad Hygiene: Remove and update references to MobileFrontend
Changes:
* Update docs
* Update browser test artifacts
* Update comments
* Update phpunit test groups
* Update phpunit test namespace
* Update `die` when MobileFrontend not installed
* Remove the migrate script which is no longer needed

Change-Id: I83432b3f7f0bcd07ed08259972b8ff89147104b6
2017-07-19 14:21:50 -07:00
jdlrobson 747b712509 Minerva should use mediawiki.hlist
Override provided styles

Bug: T42062
Depends-On: I9305af5d30c8c24b44f4a0c6a466581c45fa3028
Change-Id: I7adda8ef99e5eee3df5bd7dc4da5081c1225f815
2017-07-19 13:52:09 -07:00
Piotr Miazga f86cfc6fc4 Do not show warning box when LoginForm was posted
Because there is no easy way to detect failed user login/account
creation, do not show warning box during POST request. This should
do the trick as there shouldn't be possible to display valid
login/usercreate form during POST request.

Bug: T149413
Change-Id: Ieb7a34068aaad99616ad6c43de48f70a6775882e
Depends-On: I6ba28ddaeb0f9af17fa875bd9d1265509db4b927
2017-07-19 17:21:09 +00:00
Kunal Mehta f7509adfbb Simplify onResourceLoaderGetLessVars hook
* Get ConfigFactory via its accessor, not getService()
* Avoid array_merge, use simpler syntax
* Don't use string interpolation when one variable is the entire string

Change-Id: Ic4c138fb3b83e6e9c6ff9a001dd39e03ca5029b1
2017-07-17 23:40:31 +00:00
jdlrobson b0df6367c2 Give MinervaNeue control of the minerva skin name
Change-Id: I7f004b43e11d88492b205a3584c29f72d26bad57
Depends-On: I985c4e3a88b59461d471945ccf74cd291db45a61
Bug: T166748
2017-07-12 14:49:52 -07:00
jdlrobson 2cc9516cde Minerva is its own skin
This is programmatic output from python3 scripts/migrate.py

This will result in a Minerva skin dependent on MobileFrontend.

Post merge we will rename message keys to have minerva- prefix

Bug: T166748
Change-Id: Iff1f7e63e796cc5d4a6d2ab0370e0c33248d2fce
2017-07-12 08:12:40 -07:00