Commit Graph

120 Commits

Author SHA1 Message Date
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
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