When "Template:Multiple issues" is not used, results can be confusing:
The current implementation assigns the highest priority icon to all the issues in the ambox like so:
The expected behavior is that each issue would retain its original icon like so:
Precursor
- T206177 talks about a more sustainable approach to handle severity and icons. It would be wise to talk/implement that first.
- T211257 has split the code into sensible units with different responsibilities.
Replication steps
Production:
https://en.wikipedia.org/w/index.php?title=File_viewer&oldid=855442461&useskin=minerva&minerva-issues=b
Locally:
- Use the ContentProvider patch
- Visit http://localhost:8888/w/index.php?title=File_viewer&oldid=855442461
Developer notes
Right now our code assumes that there can be only one section per page issue and that an icon is decided by the maximum severity of issues in that section.
This happens in this code block:
if ( issues.length && $metadata.length && inline ) { issues[0].issue.icon.$el.prependTo( $metadata.eq( 0 ).find( '.mbox-text' ) ); $learnMore = $( '<span>' ) .addClass( 'ambox-learn-more' ) .text( mw.msg( 'skin-minerva-issue-learn-more' ) ); if ( $( '.mw-collapsible-content' ).length ) { // e.g. Template:Multiple issues $learnMore.insertAfter( $metadata.find( '.mbox-text-span' ) ); } else { // e.g. Template:merge from $learnMore.appendTo( $metadata.find( '.mbox-text' ) ); } $metadata.click( function () { overlayManager.router.navigate( issueUrl ); return false; } );
Something like this is more desirable (looping through all the elements in $metadata):
if ( issues.length && $metadata.length && inline ) { $metadata.each( function ( i, issueEl ) { var $learnMore, $issue = $( issueEl ); issues[i].issue.icon.$el.prependTo( $issue.eq( 0 ).find( '.mbox-text' ) );
A sample and flawed patch exists: https://gerrit.wikimedia.org/r/#/c/mediawiki/skins/MinervaNeue/+/475030/
When fixing this be careful of how multiple issues works (see T202349#4782266 and T202349#4801892)
QA steps
- Visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=T206177 and make sure all the icons show for that page.
- Make sure when clicking the overlay, all icons display
- Verify issues work correctly for the non-multiple issue case e.g. https://en.wikipedia.beta.wmflabs.org/wiki/Selenium_page_issues_test_page when the page is loaded and overlay is opened.