Matthias Mullie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365607 )

Change subject: Instruct stashed upload failures to reupload file
......................................................................

Instruct stashed upload failures to reupload file

Given enough permissions, anonymous users can upload files
just fine. But when there are warnings, their failes can't
be stashed.
This is handled correctly by adding the <input type="file">
back to the form, but that could easily be overlooked:
- if you're used to being logged in and having your upload stashed
- the instructions only mention changing the description

This will slightly alter the instructions in such case so
that users are directed to re-upload their file when it
couldn't be stashed.

Bug: T115822
Change-Id: I81f5b112d158fe5f8b0850654af07d248bc3fda5
---
M includes/specials/SpecialUpload.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/07/365607/1

diff --git a/includes/specials/SpecialUpload.php 
b/includes/specials/SpecialUpload.php
index 073e58d..72fab8f 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -346,15 +346,16 @@
                $stashStatus = $this->mUpload->tryStashFile( $this->getUser() );
                if ( $stashStatus->isGood() ) {
                        $sessionKey = $stashStatus->getValue()->getFileKey();
+                       $uploadWarning = 'upload-tryagain';
                } else {
                        $sessionKey = null;
-                       // TODO Add a warning message about the failure to 
stash here?
+                       $uploadWarning = 'upload-tryagain-nostash';
                }
                $message = '<h2>' . $this->msg( 'uploaderror' )->escaped() . 
"</h2>\n" .
                        '<div class="error">' . $message . "</div>\n";
 
                $form = $this->getUploadForm( $message, $sessionKey );
-               $form->setSubmitText( $this->msg( 'upload-tryagain' 
)->escaped() );
+               $form->setSubmitText( $this->msg( $uploadWarning )->escaped() );
                $this->showUploadForm( $form );
        }
 
@@ -381,9 +382,10 @@
                $stashStatus = $this->mUpload->tryStashFile( $this->getUser() );
                if ( $stashStatus->isGood() ) {
                        $sessionKey = $stashStatus->getValue()->getFileKey();
+                       $uploadWarning = 'uploadwarning-text';
                } else {
                        $sessionKey = null;
-                       // TODO Add a warning message about the failure to 
stash here?
+                       $uploadWarning = 'uploadwarning-text-nostash';
                }
 
                // Add styles for the warning, reused from the live preview
@@ -445,7 +447,7 @@
                        $warningHtml .= $msg;
                }
                $warningHtml .= "</ul></div>\n";
-               $warningHtml .= $this->msg( 'uploadwarning-text' 
)->parseAsBlock();
+               $warningHtml .= $this->msg( $uploadWarning )->parseAsBlock();
 
                $form = $this->getUploadForm( $warningHtml, $sessionKey, /* 
$hideIgnoreWarning */ true );
                $form->setSubmitText( $this->msg( 'upload-tryagain' )->text() );
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 0599dbc..627e0cb 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -1507,6 +1507,7 @@
        "uploadbtn": "Upload file",
        "reuploaddesc": "Cancel upload and return to the upload form",
        "upload-tryagain": "Submit modified file description",
+       "upload-tryagain-nostash": "Submit re-uploaded file and modified 
description",
        "uploadnologin": "Not logged in",
        "uploadnologintext": "Please $1 to upload files.",
        "upload_directory_missing": "The upload directory ($1) is missing and 
could not be created by the webserver.",
@@ -1569,6 +1570,7 @@
        "file-deleted-duplicate-notitle": "A file identical to this file has 
previously been deleted, and the title has been suppressed.\nYou should ask 
someone with the ability to view suppressed file data to review the situation 
before proceeding to re-upload it.",
        "uploadwarning": "Upload warning",
        "uploadwarning-text": "Please modify the file description below and try 
again.",
+       "uploadwarning-text-nostash": "Please re-upload the file, modify the 
description below and try again.",
        "savefile": "Save file",
        "uploadedimage": "uploaded \"[[$1]]\"",
        "overwroteimage": "uploaded a new version of \"[[$1]]\"",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index e2857aa..a677e05 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -1697,6 +1697,7 @@
        "uploadbtn": "Button name in [[Special:Upload]].\n\nSee also:\n* 
{{msg-mw|Uploadbtn}}\n* {{msg-mw|Accesskey-upload}}\n* 
{{msg-mw|Tooltip-upload}}\n{{Identical|Upload file}}",
        "reuploaddesc": "Used as button text in the Upload form on 
[[Special:Upload]].\n\nSee also:\n* {{msg-mw|upload-tryagain|Submit button 
text}}\n* {{msg-mw|ignorewarning|button text}}",
        "upload-tryagain": "Used as Submit button text in 
[[Special:Upload]].\n\nSee also:\n* {{msg-mw|Uploaderror|section header}}\n* 
{{msg-mw|ignorewarning|button text}}\n* {{msg-mw|reuploaddesc|button text}}",
+       "upload-tryagain-nostash": "Used as Submit button text in 
[[Special:Upload]] when the upload could not be stashed & the file needs to be 
reuploaded.\n\nSee also:\n* {{msg-mw|Uploaderror|section header}}\n* 
{{msg-mw|ignorewarning|button text}}\n* {{msg-mw|reuploaddesc|button text}}",
        "uploadnologin": "Used as title of the error message 
{{msg-mw|Uploadnologintext}}.\n{{Identical|Not logged in}}",
        "uploadnologintext": "Used as error message.\n\nThe title for this 
message is {{msg-mw|Uploadnologin}}.\n\nParameters:\n* $1 - link text 
{{msg-mw|Loginreqlink}}. The link points to [[Special:UserLogin]].\nSee 
also:\n* {{msg-mw|Whitelistedittext}}\n* {{msg-mw|Nocreatetext}}\n* 
{{msg-mw|Loginreqpagetext}}",
        "upload_directory_missing": "Parameters:\n* $1 - directory name",
@@ -1759,6 +1760,7 @@
        "file-deleted-duplicate-notitle": "Used in [[Special:Upload]] when the 
title of the deleted duplicate is not available.\n\nSee also:\n* 
{{msg-mw|file-deleted-duplicate}}",
        "uploadwarning": "Used as section header in [[Special:Upload]].",
        "uploadwarning-text": "Used in [[Special:Upload]].",
+       "uploadwarning-text-nostash": "Used in [[Special:Upload]], when the 
upload could not be stashed & the file needs to be reuploaded.",
        "savefile": "When uploading a file",
        "uploadedimage": "{{ignored}}This is a ''logentry'' message only used 
on IRC. $1 is the name of the file uploaded.",
        "overwroteimage": "{{ignored}}This is a ''logentry'' message only used 
on IRC. $1 is the name of the file uploaded.",

-- 
To view, visit https://gerrit.wikimedia.org/r/365607
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81f5b112d158fe5f8b0850654af07d248bc3fda5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to