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:
parent
3dc9cff2c2
commit
8ee27ed610
|
@ -1,5 +1,8 @@
|
||||||
( function ( M ) {
|
( function ( M ) {
|
||||||
|
/** @typedef {Object.<number | 'all', IssueSummary[]>} IssueSummaryMap */
|
||||||
|
|
||||||
var Page = M.require( 'mobile.startup' ).Page,
|
var Page = M.require( 'mobile.startup' ).Page,
|
||||||
|
/** @type {IssueSummaryMap} */
|
||||||
allIssues = {},
|
allIssues = {},
|
||||||
KEYWORD_ALL_SECTIONS = 'all',
|
KEYWORD_ALL_SECTIONS = 'all',
|
||||||
config = mw.config,
|
config = mw.config,
|
||||||
|
@ -74,7 +77,13 @@
|
||||||
issueSummaries[ i - 1 ].issue.grouped,
|
issueSummaries[ i - 1 ].issue.grouped,
|
||||||
multiple = isGrouped && !lastIssueIsGrouped;
|
multiple = isGrouped && !lastIssueIsGrouped;
|
||||||
// only render the first grouped issue of each group
|
// 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 ) {
|
} else if ( issueSummaries.length ) {
|
||||||
pageIssueFormatter.insertPageIssueNotice( labelText, section );
|
pageIssueFormatter.insertPageIssueNotice( labelText, section );
|
||||||
|
@ -96,7 +105,7 @@
|
||||||
// Note section.all may not exist, depending on the structure of the HTML page.
|
// 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.
|
// 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.
|
// 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 ) {
|
function ( all, key ) {
|
||||||
return all.concat( allIssues[ key ] );
|
return all.concat( allIssues[ key ] );
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue