Commit graph

324 commits

Author SHA1 Message Date
Clare Ming cc2fd8d66f Remove SearchLogger
Remove the searchLogger as part of the bigger cleanup to remove MobileWebSearch schema in MobileFrontend

Bug: T282167
Change-Id: I13db335859adc93d92acf3228bf381fc4c81898d
2021-06-10 15:50:57 -06:00
Cormac Parle 8b55462bc0 Read default search page from the existing search, pass to MobileFrontend
Bug: T279057
Change-Id: Ib2661f5bf335aef819b80ebd691c57e2508571a0
2021-04-01 17:36:18 +01:00
Piotr Miazga (polishdeveloper) 5a2527d71d Drop smart logout handling in favor of core ready.js
MediaWiki core added support of overrideLogoutSelector skin
config variable which allows us to define the logout button
selector. Thanks to that we do not have to ship our
custom/duplicated smart logout handler as we can use the
one shipped with ready.js.

Depends-On: Id313337c85229a5e8d0aada3a67d722048709597
Bug: T259200
Change-Id: Ie0192a176dfa8be994a544221aa71de75028d502
2021-02-11 17:26:47 +00:00
jdlrobson 99a78e6fae Avoid errors on malformed URIs when loading media viewer
Previously overlay manager required an Overlay or Deferred return
type, now it must be an Overlay.

On top of this, the media viewer must consider URIs that cannot
be decoded, so a try/catch is required.

Bug: T262703
Change-Id: Iac4bcfedba87c61021d7887155612c451f8e83b4
2020-12-04 19:34:51 +00:00
jdlrobson 1b9ec30472 Apply workaround for iOS menu bug to next 9 minor versions of iOS
Bug: T264376
Change-Id: I569e7dd5eae888de42f81f3973a23fb832b2c942
2020-11-04 14:38:03 -08:00
jdlrobson ed0222b0d0 Remove client side error counting
Bug: T266359
Change-Id: I5350c801e7ecb7b8b28e54410cc57fd3b548b2ef
2020-10-23 11:09:22 -07:00
jdlrobson 12940ac3eb Special handling for hash fragments we cannot decoded
Bug: T264914

Change-Id: Ie0aa321b5a267728881f75c498fa75929afcc972
2020-10-20 12:26:54 -07:00
jdlrobson 02ebb84ea0 Hot fix: Use display for hiding/showing sidebar on OS 14_0
Note, this removes a visibility animation.

Bug: T264376
Change-Id: I3589c615a8739e5ece6538acf42ff1292be84d71
2020-10-06 15:58:41 +00:00
jenkins-bot aeaa20d88f Merge "watchstar: Add temp-watched css class when expiry is present" 2020-09-25 06:49:42 +00:00
Dayllan Maza 0fc40f71c5 watchstar: Add temp-watched css class when expiry is present
MobileFrontend extension is currently tracking watched/temp-watch
css classes and applying animations to the "watch" event.
This patch starts adding temp-watched accordingly now that the
expiry is part of the event's data.

Note: this patch does not fix the lack of animation when transitioning
from half-star to empty-star or on page-load when the page is
temporarily watched but it fixes the awkward angle the half-star
icon was left in when transitioning from a full-star to a half-star

Bug: T262862
Change-Id: I1c8cb9c33cda76b87b6a9f15e408d88edbf61d93
2020-09-24 12:21:33 -04:00
Ed Sanders 1cea342431 build: Update eslint-config-wikimedia to 0.17.0
Change-Id: I0b917095bc84ff8b3a745f2d8b1e8541b9817bc8
2020-09-16 13:48:53 +00:00
Dayllan Maza f78d7c11e9 watchstar: Add expiry support to watchpage.mw event
The watchpage.mw event triggered on core now sends in the expiry value
if the watchlist is being watched temporarily. This patch is to
handle the star icon accordingly.

Bug: T261970
Depends-On: I9e31e41e3438ebc5e6e462f5136af5c36ba34194
Change-Id: Ia47190c1aaf4492a6cc31873a5b3bec75f2fec86
2020-09-14 09:23:33 +00:00
jenkins-bot a33a00e572 Merge "Show half star for temporarily watched pages" 2020-08-29 10:00:17 +00:00
MusikAnimal 4a3e1fa9e8 Show half star for temporarily watched pages
This does not complete watchlist expiry support in MinervaNeue. It only
instructs the skin to show a half star instead of a full star on page
load if the page is being temporarily watched.

Bug: T251690
Change-Id: Ib5c479dcfe49041152ba662c56cc630c32eb220e
2020-08-27 11:57:13 -04:00
Kosta Harlan a061d4062f Add route for excluding language suggestions
In MobileFrontend, we have code that provides the ability to load the
language info overlay without suggestions.

Currently /languages/all shows all languages without suggestions.
This patch will show suggestions on /languages/all but omit them
inside a new route: /languages/all/no-suggestions

Bug: T232410
Depends-On: Icce2631b2d5d80defc2287fb83f58f97a82a1b1e
Change-Id: Ide8e39b167f09842dd05eae7c26aeb741c29cd64
2020-08-26 19:12:56 +00:00
jenkins-bot 4cfe275cdc Merge "Add languages/all route for LanguageInfo overlay" 2020-07-28 01:44:48 +00:00
Kosta Harlan f915d69872 Add languages/all route for LanguageInfo overlay
Depends-On: Ic0f1613e8fd27788f67ed6235386491f0fe077c3
Bug: T232410
Change-Id: Ib558dc7c46cc56ff667957f9126bbe0471d25b8e
2020-07-27 12:39:50 +02:00
jdlrobson 346bfba3f4 Nested references should not trigger console warning
I don't think it will fix the failing browser tests
but it will rule out Minerva / MobileFrontend as the cause in the
analysis.

This mirrors the codepath in Minerva that's triggering the warning.

Bug: T258096
Change-Id: Idd1c224c02e3d300889b6735fa1b9800212690ff
2020-07-24 22:09:07 +00:00
jdlrobson 6b8f8568a1 Restrict the number of errors we log in a given session
One IP address, logged 3,029 errors across 2 pages
This is not helpful as it makes the error seem more widespread
than it really is so let's not logged errors after the first 5.

Change-Id: I8abfc3c3852827ab84a06740356e9b9f659a2d03
2020-07-17 19:05:25 +00:00
Ed Sanders a32999e641 build: Update eslint-config-wikimedia to 0.16.0
Change-Id: Icabf6e065ed5685207731262db72faf848a0a04d
2020-06-04 08:39:32 -07:00
jdlrobson 534bca9e5f Cleanup: Remove unnecessary lazy loading wire up code
Lazy loading images is now untangled from the Skin code so there is
no reason to call this anymore.

Lazy loading image is a MobileFrontend responsibility not a Minerva.
Minerva doesn't need to know anything about it.

Bug: T246838
Depends-On:  Ibeee7cae4b85ba888d0fecccdeec232ddd4cde0f
Change-Id: I4c4ef896b81ee494637a64d1087faa62a6f7c589
2020-05-26 19:10:26 +00:00
Jan Drewniak 145d23ee0f Exclude localStorage errors from error-logging
Bug: T253084
Change-Id: I1117be62d5a5ae0725836fae49fd325a07b0f83d
2020-05-26 13:08:48 +02:00
Bartosz Dziewoński a1e75213da Fix posting talk page replies on pages with subsections
The MobileFrontend section numbers that were used here only count
top-level sections, but this value was passed to code in
MobileFrontend's TalkSectionOverlay#onSaveClick, which uses an API
expecting the standard MediaWiki section numbers.

Extract the section number from the section edit link, like we do
in mobile.init/editor.js in MobileFrontend.

Also, disable the special talk page view unless we're viewing the
latest revision of the page. That could also lead to posting in the
wrong section, as sections are often added and removed, which changes
the numbers.

Bug: T252828
Change-Id: I553a508658804dd8672f2268b7118f77458a9dba
2020-05-14 22:57:00 +02:00
Sohom Datta 312b52cfb5 Replacing instances of toast.show() with mw.notify()
Replacing toast.show() with mw.notify() as per change 594766

Bug: T212542
Change-Id: Ibb2bb28a8898979754a924305e67e23bc019f663
2020-05-13 16:59:07 +05:30
Jan Drewniak 5144e73313 Remove "last-modified-bar__text" as a JS selector
When enchancing the watchlist items with the "time ago"
feature, the "last-modified-bar__text" class is added
to the element, which could have unexpected consequences.

That class is removed from the watchlist and instead
of using it as a JS selector, the `modified-enhancement`
class is used for both the watchlist and last-modified
bar.

Change-Id: I4a157adf51b9ed45bcba977f4f6622c7991471ba
2020-04-30 16:17:23 +02:00
Volker E 18ab61d4fe Use .text-overflow() mixin from 'mediawiki.mixins'
Removing MinervaNeue's own mixin now that it's possible.
Also unify code instances to use new mixin.

Depends-On: Ia8d6e7229b49598b0f4cb19dff463ffe2f11a43d
Change-Id: Iaffcefcb7a239d5ddecbe17097573d06099de88e
2020-04-21 11:49:30 -07:00
jdlrobson 2e32f41fd3 Drop skins.minerva.icons.image module now cache has cleared
Bug: T244444
Change-Id: I181d41f60481efa904d5e951cf08480bbae82015
2020-04-10 17:36:46 +00:00
jdlrobson 276ae636fe Use standardized icon classes and fix some missing icons
The icon pack wikimedia.ui was strangely using a non-standard
icon class using empty strings as a way to disable the default behaviour
of setIcon. Instead of fighting APIs - use the methods available.

The icon pack is also renamed to reflect what it's actually used for -
providing icons for overflow menus and it is no longer loaded as a dependency
by skins.minerva.scripts

Fixes issues with:
* History icon with AMC disabled and user is logged in
* Table of contents icon
* Language icon when it appears in overflow menu on user pages
when logged in where AMC is disabled
* listBullet appears in 2 modules as it is used in 2 places - the AMC
overflow menu (log icon on user overflow menu) and for table of contents
(JS only)

Bug: T232383
Change-Id: I05220ffa56195be6a594e3a8a57ae16858088444
2020-04-02 01:37:33 +00:00
Volker E 98d3225fc8 Rename several icons to WikimediaUI naming
Renaming to WikimediaUI standard naming and adding to module
skins.minerva.icons.wikimedia which is loaded via addModuleStyles
 'edit' → 'editLock'
 'edit-enabled' → 'edit'
 'toc' → 'listBullet' (already included in wikimedia.ui module)
 'mainmenu' → 'menu'
 'language-switcher' → 'language'
 'clock' → 'history'

Icon `page-actions-overflow` which is only needed on AMC is moved out of the stable icon
pack and added to skins.minerva.mainMenu.advanced.icons temporarily which is loaded on AMC pages only:
 'page-actions-overflow'

Additional changes:
* Renaming 'clockIconClass' to 'historyIconClass' to stay on name.
* Module `skins.minerva.icons.images` is deprecated and shipped for old
HTML markup. It will be removed in 2 weeks.

Bug: T232383
Change-Id: Ia3bafc74a85293c2414c0ef4ccf3bb20c75135d1
2020-03-31 11:48:57 -07:00
Volker E 28361446f9 Remove obsolete fallback CSS classes
Introduced in I0f929f2f3b11362

Bug: T244444
Change-Id: I7e45adf0549c35aaa0c8390329e20d205126f616
2020-03-26 17:52:58 -07:00
jdlrobson 1200cb5279 Storybook added to MinervaNeue
For now just adding story entries for footer element and last modified.

Bug: T244106
Change-Id: Ib36f22f9b9d805f87fc074d12473497cfaf91b79
2020-03-03 15:22:34 +00:00
jdlrobson fb36687fc3 setAttribute takes a string not an array
Since we are dealing with arrays here with the value of classes
but using native DOMElement we need to convert the array to a string

Follow up to  I331912a1cd6cd4293c22a1a48bb32cdec48bd37d

Change-Id: If08d68af8cebecaea02cc29bf779d25d58c0c6c3
2020-03-02 12:05:42 -08:00
jdlrobson 6b6c6b8d6e Menu items added via addPortletLinks should look like other menu items
Requires `I4c477c88ce48484960e40609cd243e63639175bc` to function.

Bug: T236711
Change-Id: I331912a1cd6cd4293c22a1a48bb32cdec48bd37d
2020-02-29 00:11:28 +00:00
jenkins-bot 30fac0ca85 Merge "Do not allow raw HTML in talk page overlay header" 2020-02-18 23:48:37 +00:00
jdlrobson 7f47dff5e5 Use icons in skins.minerva.mainMenu.icons from OOUI
For all mainMenu icons pull from OOUI icon packs.

We make the necessary changes to Definitions.php, ToolbarBuilder
and LogoutMenuEntry to ensure to update icon glyph names.

There are caching implications for icons that show to anonymous users -
these have been fixed for grade A browsers running JS by appending the
new class to impacted elements.

Grade C browsers being served cached HTML will not benefit from this
emporary fix as available solutions are costly.
As a result these users will not see icons until the cache
expires (maximum of 4 weeks but likely 1 week) or is flushed via
action=purge.

This is acceptable given the amount of impacted users and the fact that
icons are not essential for using the main menu.

Note: The communityportal.svg icon while in the resources folder was
not referenced anywhere in the codebase so its removal is safe.
Please note the same icon in skins.minerva.mainMenu.advanced.icons which
is used for the community portal menu item.

Bug: T244444
Change-Id: I0f929f2f3b11362e02f0d02f57b90b34b5c93d24
2020-02-17 20:36:28 +00:00
jdlrobson 1213eb6ab3 Do not allow raw HTML in talk page overlay header
Bug: T243650
Change-Id: Icb844fb6476d07e7fc0e470d469f2ec3220066f4
2020-02-17 11:19:45 -08:00
Nicholas Ray 17a3c4bee0 Remove eslint "valid-jsdoc" rules/fix linting errors
Our eslintrc file extends "wikimedia/client" which already includes all
of the previously listed jsdoc rules [1]. Therefore, we were clobbering
this much more thorough list.

This commit removes this clobbering and enables a much more extensive
list of jsdoc rules. Additionally, downloadPageActions was made to
conform to the rules.

[1] 07320f16ae/common.json (L99-L137)

Bug: T239269
Change-Id: I19c09054ba0bf2746ac78befc1b44426352113ec
2020-02-07 13:59:24 -07:00
jdlrobson 1e64fc8f3d Dev: Address some FIXMEs
* Drop non-existent pointer-overlay selector
* Drop redundant icon class for arrow
* Drop unnecessary !important
* Drop transparent-shield class
* Reword an existing FIXME about a contensious decision and
add a new FIXME for moving some code to a more appropriate place.
* Move an image into a ResourceLoaderImage module (test with
`mw.notify('error', { type: 'error'} )`)

Change-Id: I6e38f07772afae6f13c4851ca17a67d52ca7d331
2020-02-03 08:43:18 +00:00
jdlrobson db29aa53bd Make MobileFrontend dependency a soft one
This extends the work in Ie29a1eb7746d56f7d8c99b74e5e3c213c30fdcf2

Bug: T171000
Change-Id: Ib125e1bdaace1893804892909c27a9f328445835
2020-01-17 14:02:23 -08:00
Nicholas Ray f38d025b38 🐛 Make Talk Page Support Sections With Any Valid Id
Clicking on any talk page section should now open it regardless of the
characters in it. This includes ascii and non-ascii characters.

There are two changes done here:

1) When a user clicks on a section, `window.location.hash` is set to the
percent encoded version of the associated id attribute of the section.
This is important because, unfortunately, different browsers can encode
characters that do not conform to RFC 3986 (illegal URI characters) [1]
differently when calling `window.location.hash` again [2] (e.g. chrome
encodes `>` as '%3E' while safari leaves it as '>').

2) Register the encoded version with OverlayManager. OverlayManager will
simply do a strict string equality check when checking if the current
path matches. Because the browser will navigate to the percent encoded
version in step one and this version does not contain any illegal URI
characters, `window.location.hash` should give back the same percent
encoded string and the paths will match across browsers.

**Why not put this logic in OverlayManager?**

Alternatively, we could make OverlayManager decode the current route's
hash fragment and make it compare that with the unencoded version of the
id similar to the work in
I9cdaf3b01c2e5fe25512b6c18dcf6787c4422abd. However, ids with the '%'
character would then pose problems (e.g. `decodeURIComponent('100%')`
throws an error). This would require extra logic in OverlayManager to
differentiate client supplied '%' characters from browser encoded ones.

Making OverlayManager responsible for normalizing hash fragments will
make it more complicated than it already is. However, making the client
only register routes in OverlayManager that conform to RFC3986 from the
start avoids all of this logic at the expense of making the client make
one call to encodeURIComponent (if necessary).

If this patch is agreed upon, then the next step would be to change the
jsdoc `add` method  in OverlayManager to be explicit that it will only
work with URIs that conform to RFC3986 and the client should percent
encode if necessary before registering.

[1] https://tools.ietf.org/html/rfc3986
[2] https://bugs.webkit.org/show_bug.cgi?id=180396 (Thanks to TheDJ for
pointing this out)

Bug: T238364
Change-Id: Idc2cfac51c40f585c5d43713d8edf848b10424fd
2020-01-16 20:48:58 +00:00
Nicholas Ray 27bc60716d Remove redundant click handling from Minerva drawers.js
MobileFrontend's Drawer component already adds a mask that covers
the whole screen intercepting any clicks to the `body` tag and as a
result handles hiding the drawer when clicked.
Therefore, this code is redundant.

Change-Id: I7cb9ee240400e5bb0f7ca8480cd5321210ed1d7d
2020-01-14 11:59:30 -08:00
Nicholas Ray fdcfcf2849 Remove amc outreach from talk page
As discussed in stand up we no longer need this feature on this page.

Bug: T242491
Change-Id: I2f3e4b4028593c908f0e01055d6fd772734581f8
2020-01-14 11:52:54 -07:00
Nicholas Ray 9c2ba25ca2 Update amc outreach code to reflect new drawer changes
The Drawer API was changed in Ib123efe6af1b167706a73c71c860c85e7f439cc5
to have clients in charge of appending drawers to the DOM.

To reflect and make AMC outreach drawer work with these changes, the
amcOutreach.js code in MF was refactored  in
I8aa3f2c1fe1f638810a20a5e77eb5f2e2f6addd1 to make the showIfEligible
method return the drawer instead of calling show on it.

This work refactors Minerva to make use of both of these changes.

Additional changes:

* Removes amcOutreach click handler for talk button. Talk button is a
tab everywhere except main page (I think) now so this code is just
confusing.

Bug: T242491
Depends-On: I8aa3f2c1fe1f638810a20a5e77eb5f2e2f6addd1
Change-Id: I01afe765cbcb5e79e419a3e42b3125f513e1f87e
2020-01-14 02:04:57 +00:00
jdlrobson 46f28730e1 Do not add the navigation-enabled class to body tag for drawers
This class is used for the main menu exclusively. Applying it
will reveal 2 transparent shields on top of each other when is
not desired

Bug: T214049
Change-Id: I8ddcc7082c3c602a78084157c2d613366a8016c7
2020-01-14 01:20:40 +00:00
Nicholas Ray c22eab914e Add minerva-animations-ready CSS class in Minerva
Per T234570, browser support for animations is solid now so we no longer
need to check for browser support.

However, due to some browsers firing css transitions on page load (see
https://bugs.chromium.org/p/chromium/issues/detail?id=332189), we still
need JS to add this wrapping class after CSS transitions are loaded to
prevent the transitions firing on page load for some components
(DropDownList and MainMenu). See MainMenu.less or DropDownList.less for
an example of how this is used.

MobileFrontend adds an animations class too rn, but that will be removed
in in I58f754740f7146f09c38220a7614285e57684924.

Bug: T234570
Change-Id: If0cf7113b40f7217a22b66a8669138466af2cf5d
2020-01-09 13:58:37 -07:00
Fomafix f482ee198e Use document.body and document.documentElement as jQuery selector
The eslint-disable directive jquery/no-global-selector is not needed
anymore.

Change-Id: Ia520232d6ae94a726b5c0768a8245ab555c79112
2020-01-06 14:33:44 +01:00
jenkins-bot acb42e4fad Merge "Simplify menu code" 2019-12-19 22:34:52 +00:00
jdlrobson 3c5edfa5cd Simplify menu code
Now the main menu is not using JavaScript we can simplify
the menu code to apply only to the Echo navigation drawer.

Bug: T225213
Change-Id: If4831fc700c7df3a2a389b5f95b6fbaea4b7d954
2019-12-19 12:14:13 -08:00
jdlrobson 48adb2c5bf CtaDrawers no longer stay behind in DOM
A new controller is added - drawers.js with methods for controlling
display and removal of drawers. The existing code in references is
moved there and extended to support scroll to hide behaviour

Console warnings will disappear with this change.

Additional changes:
* Standardise the page issues element selector - should be the container
not a link inside it (was a red link so triggering wrong behaviour)

Bug: T214045
Change-Id: Id4719b5209dd7647775e2959e46dbae0c3dde3ac
2019-12-19 19:56:02 +00:00
Jan Drewniak ec56a60694 Fix typo in class definition
Change-Id: Ide0fff7f7e53dd42d322a2ab3b06f5e9a8de8daf
2019-12-18 23:46:50 +01:00