Last modified: 2011-12-07 21:52:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33341, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31341 - multiple file selection doesn't respect maxUpload config
multiple file selection doesn't respect maxUpload config
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
UploadWizard (Other open bugs)
unspecified
All All
: High normal (vote)
: ---
Assigned To: Jeroen De Dauw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-04 07:06 UTC by Neil Kandalgaonkar
Modified: 2011-12-07 21:52 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Neil Kandalgaonkar 2011-10-04 07:06:36 UTC
If you select more than the configured maxUploads, the UI will add all the files anyway.

There is some asynchrony that was not an issue before.

- an "upload" is not necessarily a filled upload. The file input hovering over the "add a file" button belongs to an unfilled upload. Filled uploads are added to the wizard's list of uploads. Unfilled uploads are just sort of UI elements waiting to turn into the real thing.

- in newUpload(), there is a check of the wizard's count of uploads; it returns false if current length = max

- but, there is a very slight delay between creating a new upload and marking it filled (this is async). And the upload is only added to the wizard at the "filled" trigger event

- there is some attempt to fix this with the change() invocation for synthetically created providedFile -- maybe this should be the filled trigger. Or both?
Comment 1 Jeroen De Dauw 2011-11-23 23:38:22 UTC
Fixed by r104103. Maybe it can be done in a nicer way, but I did not see any after poking at the code a bit.
Comment 2 Neil Kandalgaonkar 2011-11-23 23:46:42 UTC
This will work but I think the solution needs to be a bit better.

1 - it's really inelegant to do all the work of adding uploads and then removing them. There are all sorts of side effects (for one, there are a few static "counters" in various classes). 

Multiple files are launched around line 333 of mw.UploadWizardUpload.js, maybe start from there?


2 - after someone goes over the limit, we need to throw up a dialog to explain to them what happened. Otherwise they will probably not notice.


By the way, after they are over the limit, check that the 'new upload' button is properly disabled
Comment 3 Jeroen De Dauw 2011-11-24 00:09:12 UTC
Right.

> Multiple files are launched around line 333 of mw.UploadWizardUpload.js, maybe
start from there?

Ah, that seems more promising then where I was looking :)
Comment 4 Jeroen De Dauw 2011-11-24 00:34:31 UTC
Second attempt in r104117 - still need to do the warning thing though.
Comment 5 Jeroen De Dauw 2011-11-24 00:35:59 UTC
Any suggestion on how to display such a warning? Is there any appropriate warning display thinghy yet, or do I need to create something new?
Comment 6 Neil Kandalgaonkar 2011-11-24 00:38:03 UTC
(In reply to comment #5)
> Any suggestion on how to display such a warning? Is there any appropriate
> warning display thinghy yet, or do I need to create something new?

do a modal dialog with jQuery UI dialog. There are some examples in the codebase.
Comment 7 Jeroen De Dauw 2011-11-24 14:44:51 UTC
Dialog added in r104167
Comment 8 Neil Kandalgaonkar 2011-12-07 01:51:15 UTC
The current fix seems to have an off-by-one error and a few other problems.

For all below cases, in LocalSettings.php  $wgUploadWizardConfig['maxUploads'] = 5


1) Off by one error:

- Uploading files, selected File1..10.jpg

- Dialog triggered correctly, saying I had 10 files and 5 would be dropped

- However, only File1..4 were shown.

- At this point, the "Add another upload" button was still enabled

- Adding another upload brings the total to 5. No dialog is shown saying any will be dropped. "Add another upload" button is disabled. So that seems to work.


2) Does not track current total

- Add 3 files to UploadWizard, successful as usual

- Add 5 more

- Dialog triggered, incorrectly stating: "You can only upload 5 files at once. You tried to add 8 files, so 3 files have been removed." It would be more correct to say: "You can only upload 5 files at once. You tried to upload 8 files in total, so 3 files have been removed".
Comment 9 Jeroen De Dauw 2011-12-07 15:17:25 UTC
1) Ok, did not notice this myself during testing :/

2) So the only thing you want me to do is add "in total" to the message? I could also go for something like "You tried to upload 5 files while already having 3, so 3 of those have been removed." if that's clearer.
Comment 10 Neil Kandalgaonkar 2011-12-07 16:30:17 UTC
(In reply to comment #9)

> 2) So the only thing you want me to do is add "in total" to the message? 

No, I also changed "add" to "upload". 

I just think that "You tried to add 8 files" seems wrong, as it implies that I *just* tried to add 8 files.
Comment 11 Jeroen De Dauw 2011-12-07 17:03:39 UTC
Should be fixed by r105441
Comment 12 Neil Kandalgaonkar 2011-12-07 21:52:57 UTC
Looks good. Thanks for the quick fix.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links