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
Remove the unnecessary helper object in favor of making
functions standalone.
The function bodies are left intact but a level of indent is removed
Change-Id: If4ee79df096bf386584dba8d971a0858e70e166f
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
Use CtaDrawer.options.events when available instead of CtaDrawer.events.
Change-Id: I7cf5d97bef9179dfa148fa4d5ca447d128031b57
Related: I4a4129b2cac7c7c49559beef0b8780f3211edf9c
Bug: T210870
MinervaNeue depends on mobile.search and mobile.search.api. These
ResourceLoader modules existed in MobileFrontend but now have been
collapsed into mobile.startup.
This patch updates Minerva's ResourceLoader module and JavaScript
references.
Bug: T210207
Depends-On: I1eae36f2927a4e0f9d1e91d604d656beb8cc33ae
Change-Id: Ied6f4873bf2550564673296e9ef4fa009ca45e5b
Instead of having one large `createBanner` function, breaks down
that responsibility into three smaller functions:
- createPageIssueBanner
- createPageIssueBannerMultiple
- createPageIssueNotice
These functions represent issues in the new treatment, the
multiple-issues template, and the old treatment.
createBanner now delegates the creation of these banner types to these
new functions.
A new property to PageSummary, $el, has also been added. This allows us
to manipulate the issues DOM via the PageSummary object, instead of using
the `$metadata` variable in createBanner.
This approach to the page-issues DOM also solves the problem of
wrong or missing icons in T202349.
Bug: T211257, T202349
Change-Id: I50a2d8e3ae94913dc060ceedaaf1fa7e1756617f
This patch removes the remaining usages of M.on/M.off/M.emit
(functionality derived from moduleLoader.js in MobileFrontend) in
Minerva and continues the work of
Id990b0e1a53221d5c1cb3e3012aed0e27d801fc2 (patch for MobileFrontend).
This patch and the patch for MobileFrontend should be merged together as
they both depend on eachother.
Depends-On: Id990b0e1a53221d5c1cb3e3012aed0e27d801fc2
Bug: T156186
Change-Id: I005d2fcdbf91c2f1ac98178dfa388aa8174e7530
You can test this against the beta cluster using
$wgMFMwApiContentProviderBaseUri = "https://en.wikipedia.beta.wmflabs.org/w/api.php";
Bug: T206177
Change-Id: Ic2e6859443ed5aa2a3f97218f4c89df2a46000f9
* 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
This replicates the behavior of the MultimediaViewer on the
desktop when using the mobile page with a desktop browser.
But we have to be careful that this change don't break
other extensions or functions of the skin.
Bug: T206348
Change-Id: Ib4b928eae136d781782dc96e82d653806587292b
Account for the fact that many wikis use `mbox-text-div` rather
than `mbox-text-span` and that the element might not be display
block/inline block
Bug: T206887
Change-Id: I6b3cee4339fc7ddb035a99fb4929b1ab67f22333
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
The extractMessage function has a lot to do with parsing - so this
and its tests are moved into the pageIssuesParser.
Change-Id: I62d79fbba166eff2c3ca573ef94ff86a269a7f9a
We have two type defs - IssueSummary and PageIssue.
I'd like to consolidate these two types by making
IssueSummary a combination of the two
Change-Id: Ic831b463fa66b0cacdd0b9b79aff741e55c0ec24
This will send an event to a non-existent schema:
ReadingDepthSchema.enable
This was mistakedly kept for backwards compatibility.
It should have been kept for trackSubscribe not track.
The damage is done, so we should just remove this to get
error rates down to a comfortable rate again.
Bug: T207423
Change-Id: Ibb5cc2dd9b486c921aab5f8830e837f813683482
Separate the page issue grouping concern so that changes to parsing
don't concern everything else and vice-versa.
Bug: T203449, T202349
Change-Id: I7bddb0c53310805ece71b8f7821b1d6ce05cfae9
These CSS classes are specific to the Minerva skin and we want to move
this file to MobileFrontend.
Now that this code is all in one place, I noticed that it seems to not
do much at all… Everything in this function looks like it could just
be done in the PHP code. If PHP does it all, then we could remove all
of it for a free performance improvement.
Bug: T198765
Change-Id: I6487c2fc520e14e0856b2e9a6f9dfa5066205817
It was limited to the main namespace since its introduction in
Ieabe8f7071696cde6afbdc6df853aacdb741a4a3. Unfortunately that
commit does not explain the reason.
It should be shown e.g. on user pages (so that sandbox pages
look like the real article) or on project pages (many policy
or help pages on Wikipedia are long and would benefit from it).
It looks like some of the CSS code already assumed that the
TOC would be shown in all namespaces (space for it was reserved
using a 'visibility: hidden;' element on all pages).
Bug: T205312
Change-Id: Id6935f5a7a3701c1c7a38fb37b48b6a3bbc80393
Unlike other skins, Minerva wants to be in charge of when WikimediaEvents
is loaded, so that it can guarantee load order happens at a time that
suits it.
WikimediaEvents will be loaded after initialisation of the interface.
This allows Minerva to enable schemas such as ReadingDepth conditionally.
Upon merging this patch, Ibb45f40ea301727c0c6480043760bd9426106845 can
be merged which will revoke WikimediaEvent's ownership.
Merging in this order will ensure that ReadingDepth is never
removed from production.
Bug: T204144
Change-Id: If8395033f31485aca0ca3b38fda1be985369b481
In I1a471f81cc9390fc9e8665a7a336cf2dd7a063ab we excluded
edit events that led to the creation of a new page.
This restores them by providing a dedicated home for this data
in the schema.
Additional changes:
* Address some line length warnings
Bug: T204073
Change-Id: Ie7eb95f15737e94b7926d38ed6411bc0e5df2404
This event is meant to track attempts to edit the page we are on,
but also happened to catch clicks on "see talk page" links, in
case that talk page doesn't exist yet.
Bug: T204073
Change-Id: I1a471f81cc9390fc9e8665a7a336cf2dd7a063ab
The page-issues reducer function that retrieves the severityLevels
for issues was incorrectly comparing two values in the multiple-issues
scenario.
Instead of comparing the severity of the current issue with the previous
value in the accumulator, it was comparing the current issue with the
previous issue in the original array, thus ignoring the
previous `maxSeverity` value in the accumulator.
Tests added and function refactored with more explicit variable names.
Bug: T203725
Change-Id: Ia4c15cbf0c2457d68a7381e8ed04c1a6b3ae65d1
Erroneously in I6fd55c35b9e2ce35894259f36d1a50fb5dca5e43 for the old treatment
we sent sectionNumbers for all issues in the page.
This is inconsistent with the issuesSeverity field above it
Add a clarifying inline comment.
Bug: T203050
Change-Id: Ib1fcda0c49a162cd7aca8ee8b3221236f724e1d7
Rather than using err and error as variable, use error for consistency
Follow up to I07f01b4c025b2e5e4cbf88ec05e7c536442c62cc
Bug: T202026
Change-Id: I54165ff1f1b17284d8232c491244e1a98950d5e2
createBanner was incorrectly always assigning the 'all' keyword
to the old page issues banner. Instead it should use the section
number in the function signature - as this decision of which issues
to show is made inside initPageIssues
For the old treatment, in the main namespace, we only show issues
in the lead section. When we use the 'all' keyword the visual is
the same, but it breaks the instrumentation requirement that
sectionNumbers and issuesSeverity should be the correct length
Note, for the talk and category pages treatment, we do not
log any events so the instrumentation doesn't matter here
and the 'all' keyword correctly targets all issues in the page
as before.
Bug: T203050
Change-Id: I63e45da05ca033fe282633f7fd59038a8e5d8c8d
For the page-issues modalClose event, the number of values for `sectionNumbers`
and `issuesSeverity` should be the same, since `sectionNumbers` should describe
the the section of each visible issue in the modal, not the section of the
modal itself.
Bug: T203050
Change-Id: Ic58c5940a6059e71aa3aeed26232afbe8faf1618
When handling special cases that are logically distinct from
the function's main branch, it improves code quality (through
readability and maintainability) to place those first and with
an early return.
The has the benefit of the main return statement being easy to
find at the end of the function. (Not early and/or in a block).
It also means when working on the code, there is generally a
less complexity and fewer nesting levels, given that most code
is in the main branch. This makes is easier and quicker to verify
that code does what it should, as well as making it easy to
extend in the future. When considering to add code to end of a
function's main scope, it should relate to the function's main
branch by default, not a special case. For example, a getName()
method should not end with a top-level statement 'return false'
(unless it is a stub). Rather, one would expect it to end with
`return name`.
Change-Id: I1f3088f2409c82dd3bf757fc8fa27dc97ae2767b
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
"multiple issues" templates as one issue.
When logging the `issuesSeverity` and `sectionNumbers` field,
any issues that are part of a "multiple issues" template only send
one value.
Adds an `isMultiple` property to IssueSummary to determine which
issues are part of a multiple-issues template.
Bug: T203050
Change-Id: I7d55dfead72439df4accadcdc8623a080e1321c2
The value of `sectionNumbers` should be the section number of each issue
Not the number of the sections that have issues.
Bug: T203050
Change-Id: I6fd55c35b9e2ce35894259f36d1a50fb5dca5e43
Adds logging for the sectionNumbers field in the PageIssues schema.
Additional changes:
* createBanner now requires section number to be a string - this ensures
consistency with how these are used.
* fix a bug which meant createBanner was being called with undefined
section number (due to table of contents)
* Fix some indents in some JSDoc blocks
* Change parameter in function signature from mixed type (int or string)
to explicit string
* update schema number
Depends-On: Ia2696b86c6855d7b46a3f668585377d106d7af23
Bug: T202098
Change-Id: I20511a77258ea245f3d6fe93ade238e5df397a71
An event only needs to send this field when overriding the
default. This line is thus unnecessary.
Change-Id: Ia1dfcac5dd25f36f5f4169daf6535fd66aedf754
Previously, the image overlay would always be loaded asynchronously.
Given clicking left/right opens a new mediaviewer this left a jarring
white flash. By loading the image overlay synchronously after the first
has been loaded, we avoid this flash.
Note, the task does propose preloading and animating the images
but this is a much bigger change and deemed out of scope for this
particular task.
Additional change:
* Use a shared mw.Api instance for ImageOverlay and PageGateway
Bug: T197110
Change-Id: I28d06b34cdea4fedcd7fb754572191e904ecc81a
This patch updates the various usages of $.Deferred for loading
overlays in routes to be ES6 Promise compatible
Bug: T188937
Change-Id: I3fc24bf3471a99e7671d1191bdd46cb741286ee1
Move page issue overlay specific code out of cleanuptemplates and into
PageIssueOverlay to clarify what code is specific to the page issues
modal screen and what's specific to the page itself.
Bug: T191528
Change-Id: I95821ccda84306ddd5d22b57ffbae8d13ca44408
Rather than inventing its own page token the PageIssues
schema will rely on the standard page token.
In future when I9bb18d47e36d2d99d812e5b47ea9516d3dff3a16 is
merged this will mean that PageIssues and ReadingDepth have
consistent page tokens.
Bug: T201124
Change-Id: I19fea41e04cd792423ea9d41a673563418b69726
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
T196150 disabled the fallback editor when JavaScript is available.
As a result the code for page issues on the editor screen is redundant.
This simplifies our code.
The css rules relating to editor
issues are retained, given they simplify the editor screen for mobile
devices.
Bug: T196150
Change-Id: I76d586414cdd8de533bb891b87d1e0b7efc20a68
When parsing page issues by header, use the MobileFrontend selector
symbol, Page.HEADING_SELECTOR, instead of hardcoding it. This selector
is configurable by the extension.
Bug: T191528
Change-Id: I7c9db38f9102bfef0a98784be32c7e4707d747e5
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
Callback usage was removed in I67fb6e448f6ecc97c89c1187e491ee05f7a312ef
so this function may be removed.
Bug: T191532
Change-Id: I88f0d6740c9e9615faba2e3c60772269c705f43e
Uses `mw.trackSubscribe` to create an intermediary data handler
named `wikimedia.PageIssuesAB` which extends event-logging data
before passing it to the eventLogging through `wikimedia.event.PageIssues`.
Event hooks are placed where appropriate and the `CleanupOverlay`
class is extended to capture events from within the page issues
modal.
Additional changes:
* Merge two identical on click event handlers for
.edit-page, .edit-link elements
* change pageIssueParser.maxSeverity to accept an array of severity levels
instead of an array of pageIssues objects
Depends-On: Ic84e4a3286220407863167e0f57cef1b13a72964
Bug: T191532
Change-Id: I67fb6e448f6ecc97c89c1187e491ee05f7a312ef
The page issuer parser works with plain old Elements, not jQuery. Pass
in the expected type.
This addresses problems with the icon display for ambox templates relating
to balance (see https://phabricator.wikimedia.org/T191528#4465069)
Bug: T191528
Change-Id: Ie4a34087f9f1700342cc54a50cd3272fc9ea34ee
Follow up to I96808541d48be7869fed3bc30babb80866e139ec
which incorrectly wired up the page issues feature.
Bug: T200867
Change-Id: I7c3198f95dae1f7c5e0991dca651dd64949b3615
In order to write tests, we'd like to separate code without side
effects from code that executes it as part of setup.
This shuffles dependencies and makes page and overlayManager
parameters to the init function (injected dependencies)
Change-Id: I96808541d48be7869fed3bc30babb80866e139ec
The readability of cleanuptemplates is hurt by having an anonymous
function embedded inside.
This patch wraps initPageIssues with the jquery ready call and removes
the function wrapper and decreases the indent of its contents.
Purely stylistic change.
Change-Id: I44b2371add32780f96160e0075787a9ea7222f39
The hook that enables the Reading depth test should send an
additional paramter that specifies which test bucket the hook
being is calling from.
Bug: T191532
Change-Id: Ifd9f43220c476ece8a0c0cee46b62b58a717c616
Truncates ambox template styles to only show 2 lines of text.
"Learn more" link is placed on the same line as message text
and a fade is applied so that it doesn't overlap with the message text.
On table & larger layouts, the "learn more" link is placed on its
own line below the page-issue text.
Bug: T197931
Change-Id: Id607dea537c212298c02a0e1639aef2a786eb424
* truncated-text is only used in MainMenu, last modified bar,
a few special pages
Making this a mixin and limiting it to mobile.startup skinStyles
and mobile.special.styles thus makes sense
* cloaked-element is only ever added by Skin.js in mobile.startup
* position-fixed is only ever added by Skin.js
Change-Id: Iaf7061e9dda87eb25c963f8a281175af08f358e5
The transition only happens when images are loaded via JavaScript
so limit the styles to a file loaded via JS NOT render blocking
CSS
Change-Id: I56661db13e7fbb400a05b13c369d8598df449297
The section number relates to the position of the corresponding heading
not the corresponding top level section.
This only changes the URL, not the functionality. sub section issues
will continue to be grouped along with other section issues.
Bug: T197932
Change-Id: I325a3b477f89c9cc24f13ca017f478a6b7e7b68e
- 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
Per https://phabricator.wikimedia.org/T197932#4417319
Note that given talk/category overlay does not use or
display section issues, to simplify things any section other
than 0 or all will use this heading.
Bug: T197932
Change-Id: I737fb07aaadcea7772d0b08f8b0652dcf2f4623d
Parse all issues inside a page, and load them into the issues overlay.
In group A, given issues inside later sections are hidden, it will not be possible
to navigate to these new overlay screens. In group A, lead section issues will continue
to only show lead section issues.
Changes:
* The /issues route is replaced by the more specific /issues/all and
/issues/{section num}, issues are stored in an "allIssues" module object.
* Begin using constants for namespaces for better readability
* Drop width 100% - this breaks display on tablet devices of issues within
sections
* Improve createBanner documentation to explain different treatments
* Set the issues overlay header inside initPageIssues when setting up
the route.
Bug: T197932
Change-Id: I21470648a61d57cfa4befceec596cf0f6e2110ec