Page MenuHomePhabricator

Use ResourceLoader/mw.config for jsReviewNeedsChange variable
Open, LowPublic

Description

Setting one variable in an one script tag into the global scope is not best practice. Please move this var to mw.config.

$:foo\> cd ../mediawiki-extensions/FlaggedRevs/
$:foo\> grep -r jsReviewNeedsChange .
./frontend/modules/ext.flaggedRevs.review.js:		/*global jsReviewNeedsChange*/
./frontend/modules/ext.flaggedRevs.review.js:		if ( typeof jsReviewNeedsChange !== 'undefined' && jsReviewNeedsChange === 1 ) {
./frontend/RevisionReviewFormUI.php:		$s .= '<script type="text/javascript">var jsReviewNeedsChange = ' .

Details

Reference
bz34716

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:15 AM
bzimport set Reference to bz34716.

Patch welcome :-D

There are also two places, where two function (onFRChangeExpiryDropdown/onFRChangeExpiryField) are added with a own script tag. Maybe create a new module or move it to the existing modules.

(In reply to comment #1)

Patch welcome :-D

MakeGlobalVariablesScript hook?

TheDJ set Security to None.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 21 2015, 10:59 AM
Aklapper removed matthiasmullie as the assignee of this task.Dec 15 2016, 3:19 PM
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptDec 15 2016, 3:19 PM
Aklapper renamed this task from Use ResourceLoader/mw.config for jsReviewNeedsChange to Use ResourceLoader/mw.config for jsReviewNeedsChange variable.Dec 22 2016, 4:50 PM
Aklapper updated the task description. (Show Details)
hashar removed a subscriber: hashar.Jan 2 2017, 11:04 AM