Hygiene: favor page issues all sections symbol

In pageIssues.js:

- Consistently use the KEYWORD_ALL_SECTIONS symbol instead of hardcoding
  the string, "all".

- Improve typing for allIssues.

- Wrap a long line.

Bug: T212371
Change-Id: I429fe37f88311c787e91946bb1438c6961eeeb5b
This commit is contained in:
Stephen Niedzielski 2019-02-04 08:48:07 -07:00 committed by Jdlrobson
parent 3dc9cff2c2
commit 8ee27ed610
1 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,8 @@
( function ( M ) {
/** @typedef {Object.<number | 'all', IssueSummary[]>} IssueSummaryMap */
var Page = M.require( 'mobile.startup' ).Page,
/** @type {IssueSummaryMap} */
allIssues = {},
KEYWORD_ALL_SECTIONS = 'all',
config = mw.config,
@ -74,7 +77,13 @@
issueSummaries[ i - 1 ].issue.grouped,
multiple = isGrouped && !lastIssueIsGrouped;
// only render the first grouped issue of each group
pageIssueFormatter.insertPageIssueBanner( issueSummary, mw.msg( 'skin-minerva-issue-learn-more' ), issueUrl, overlayManager, multiple );
pageIssueFormatter.insertPageIssueBanner(
issueSummary,
mw.msg( 'skin-minerva-issue-learn-more' ),
issueUrl,
overlayManager,
multiple
);
} );
} else if ( issueSummaries.length ) {
pageIssueFormatter.insertPageIssueNotice( labelText, section );
@ -96,7 +105,7 @@
// Note section.all may not exist, depending on the structure of the HTML page.
// It will only exist when Minerva has been run in desktop mode.
// If it's absent, we'll reduce all the other lists into one.
return allIssues.all || Object.keys( allIssues ).reduce(
return allIssues[ KEYWORD_ALL_SECTIONS ] || Object.keys( allIssues ).reduce(
function ( all, key ) {
return all.concat( allIssues[ key ] );
},