mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-23 10:22:05 +00:00
Use packageFiles instead of startup module for config vars
Remove wgEchoMaxNotificationCount and wgEchoPollForUpdates from the startup module and put them in the ext.echo.init module. Change-Id: I03f9a3953aa97ead1a29c13a992a02404a6d0b68
This commit is contained in:
parent
b3df45dc34
commit
d378e4e3b9
|
@ -4,6 +4,9 @@
|
|||
"wikimedia/client",
|
||||
"wikimedia/jquery"
|
||||
],
|
||||
"env": {
|
||||
"commonjs": true
|
||||
},
|
||||
"globals": {
|
||||
"OO": false,
|
||||
"mw": false
|
||||
|
|
|
@ -258,8 +258,12 @@
|
|||
]
|
||||
},
|
||||
"ext.echo.init": {
|
||||
"scripts": [
|
||||
"ext.echo.init.js"
|
||||
"packageFiles": [
|
||||
"ext.echo.init.js",
|
||||
{
|
||||
"name": "config.json",
|
||||
"callback": "EchoHooks::getConfigVars"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
"ext.echo.api",
|
||||
|
@ -409,7 +413,6 @@
|
|||
"SendWatchlistEmailNotification": "EchoHooks::onSendWatchlistEmailNotification",
|
||||
"GetNewMessagesAlert": "EchoHooks::abortNewMessagesAlert",
|
||||
"LinksUpdateAfterInsert": "EchoHooks::onLinksUpdateAfterInsert",
|
||||
"ResourceLoaderGetConfigVars": "EchoHooks::onResourceLoaderGetConfigVars",
|
||||
"SpecialMuteModifyFormFields": "EchoHooks::onSpecialMuteModifyFormFields"
|
||||
},
|
||||
"config": {
|
||||
|
|
|
@ -1477,13 +1477,11 @@ class EchoHooks {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static function onResourceLoaderGetConfigVars( &$vars ) {
|
||||
global $wgEchoPollForUpdates;
|
||||
|
||||
$vars['wgEchoMaxNotificationCount'] = MWEchoNotifUser::MAX_BADGE_COUNT;
|
||||
$vars['wgEchoPollForUpdates'] = $wgEchoPollForUpdates;
|
||||
|
||||
return true;
|
||||
public static function getConfigVars( ResourceLoaderContext $context ) {
|
||||
return [
|
||||
'EchoMaxNotificationCount' => MWEchoNotifUser::MAX_BADGE_COUNT,
|
||||
'EchoPollForUpdates' => $context->getConfig()->get( 'EchoPollForUpdates' )
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
alertModelManager,
|
||||
unreadMessageCounter,
|
||||
unreadAlertCounter,
|
||||
maxNotificationCount = mw.config.get( 'wgEchoMaxNotificationCount' ),
|
||||
pollingRate = mw.config.get( 'wgEchoPollForUpdates' ),
|
||||
maxNotificationCount = require( './config.json' ).EchoMaxNotificationCount,
|
||||
pollingRate = require( './config.json' ).EchoPollForUpdates,
|
||||
documentTitle = document.title,
|
||||
$existingAlertLink = $( '#pt-notifications-alert a' ),
|
||||
$existingMessageLink = $( '#pt-notifications-notice a' ),
|
||||
|
|
Loading…
Reference in a new issue