mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 01:30:15 +00:00
Use utility functions to improve code readability
Change-Id: Idf39028d41293b33153254f7648babc3a0cb2b82 Follows-Up: I8cdeb9ee920d3ec943e270eb00a6ef7f3a7449e2 Bug: T226127
This commit is contained in:
parent
f61c2a569e
commit
2a4fde702a
|
@ -102,10 +102,6 @@
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
// change document title on initialization only when polling rate(feature flag) is non-zero.
|
|
||||||
if ( pollingRate !== 0 && mw.user.options.get( 'echo-show-poll-updates' ) === '1' ) {
|
|
||||||
updateDocumentTitleWithNotificationCount( alertCount, messageCount );
|
|
||||||
}
|
|
||||||
|
|
||||||
function isLivePollingFeatureEnabledOnWiki() {
|
function isLivePollingFeatureEnabledOnWiki() {
|
||||||
return pollingRate !== 0;
|
return pollingRate !== 0;
|
||||||
|
@ -122,6 +118,11 @@
|
||||||
return mw.user.options.get( 'echo-show-poll-updates' ) === '1';
|
return mw.user.options.get( 'echo-show-poll-updates' ) === '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Change document title on initialization only when polling rate feature flag is non-zero.
|
||||||
|
if ( isLivePollingFeatureEnabledOnWiki() && userHasOptedInToLiveNotifications() ) {
|
||||||
|
updateDocumentTitleWithNotificationCount( alertCount, messageCount );
|
||||||
|
}
|
||||||
|
|
||||||
function loadEcho() {
|
function loadEcho() {
|
||||||
if ( loadingPromise !== null ) {
|
if ( loadingPromise !== null ) {
|
||||||
return loadingPromise;
|
return loadingPromise;
|
||||||
|
@ -270,7 +271,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function pollStart() {
|
function pollStart() {
|
||||||
if ( mw.config.get( 'skin' ) !== 'minerva' && pollingRate !== 0 ) {
|
if ( mw.config.get( 'skin' ) !== 'minerva' && isLivePollingFeatureEnabledOnWiki() ) {
|
||||||
// load widgets if not loaded already then start polling
|
// load widgets if not loaded already then start polling
|
||||||
loadEcho().then( pollForNotificationCountUpdates );
|
loadEcho().then( pollForNotificationCountUpdates );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue