MarkTraceur has submitted this change and it was merged.
Change subject: Restore concurrent uploading functionality.
......................................................................
Restore concurrent uploading functionality.
The preference for concurrent uploads was broken in two ways:
1) No default option was specified via $wgDefaultUserOptions.
This meant that until the preference was set, it would not
work.
2) In turn, the 'default' property of the preferences array was
misused. From Preferences.php:
"Note that the 'default' field is named for generic forms, and does
not represent the preference's default (which is stored in
$wgDefaultUserOptions), but the default for the form field, which
should be whatever the user has set for that preference. There
is no need to override it .."
Bug: 48090
Change-Id: I0d9f13c6b7698056d4f9ed113b9b23b2f266263d
---
M UploadWizard.php
M UploadWizardHooks.php
M resources/mw.UploadWizard.js
3 files changed, 10 insertions(+), 3 deletions(-)
Approvals:
MarkTraceur: Looks good to me, approved
jenkins-bot: Verified
diff --git a/UploadWizard.php b/UploadWizard.php
index 74313af..7f690eb 100644
--- a/UploadWizard.php
+++ b/UploadWizard.php
@@ -97,6 +97,7 @@
$wgDefaultUserOptions['upwiz_deflicense'] = 'default';
$wgDefaultUserOptions['upwiz_def3rdparty'] = 'default';
$wgDefaultUserOptions['upwiz_deflicensetype'] = 'default';
+$wgDefaultUserOptions['upwiz_maxsimultaneous'] = 'default';
// Init the upload wizard config array
// UploadWizard.config.php includes default configuration
diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index f8b75a5..3393659 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -611,7 +611,6 @@
// Setting for maximum number of simultaneous uploads (always
lower than the server-side config)
if ( $config[ 'maxSimultaneousConnections' ] > 1 ) {
-
// Hack to make the key and value the same otherwise
options are added wrongly.
$range = range( 0, $config[
'maxSimultaneousConnections' ] );
unset( $range[0] );
@@ -620,7 +619,6 @@
'type' => 'select',
'label-message' =>
'mwe-upwiz-prefs-maxsimultaneous-upload',
'section' => 'uploads/upwiz-experimental',
- 'default' => $config[
'maxSimultaneousConnections' ],
'options' => $range
);
}
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index 5026595..e6005d8 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -15,7 +15,15 @@
// XXX need a robust way of defining default config
this.maxUploads = mw.UploadWizard.config[ 'maxUploads' ] || 10;
- this.maxSimultaneousConnections = mw.user.options.get(
'upwiz_maxsimultaneous' ) || 1;
+
+ var maxSimPref = mw.user.options.get( 'upwiz_maxsimultaneous' );
+ if ( maxSimPref === 'default' ) {
+ this.maxSimultaneousConnections = mw.UploadWizard.config[
'maxSimultaneousConnections' ];
+ } else if ( maxSimPref > 0 ) {
+ this.maxSimultaneousConnections = maxSimPref;
+ } else {
+ this.maxSimultaneousConnections = 1;
+ }
this.makePreviewsFlag = true;
this.showDeed = false;
--
To view, visit https://gerrit.wikimedia.org/r/62320
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0d9f13c6b7698056d4f9ed113b9b23b2f266263d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Eloquence <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Nischayn22 <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits