From acc5df9d74dfd22d8de9192b5cff4247a4d658b4 Mon Sep 17 00:00:00 2001 From: Matthias Mullie Date: Mon, 17 Jul 2017 16:23:32 +0200 Subject: [PATCH] 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 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 --- includes/specials/SpecialUpload.php | 10 ++++++---- languages/i18n/en.json | 2 ++ languages/i18n/qqq.json | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 4cdc78f341..fe16b90bfa 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -345,15 +345,16 @@ class SpecialUpload extends SpecialPage { $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 = '

' . $this->msg( 'uploaderror' )->escaped() . "

\n" . '
' . $message . "
\n"; $form = $this->getUploadForm( $message, $sessionKey ); - $form->setSubmitText( $this->msg( 'upload-tryagain' )->escaped() ); + $form->setSubmitText( $this->msg( $uploadWarning )->escaped() ); $this->showUploadForm( $form ); } @@ -380,9 +381,10 @@ class SpecialUpload extends SpecialPage { $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 @@ -444,7 +446,7 @@ class SpecialUpload extends SpecialPage { $warningHtml .= $msg; } $warningHtml .= "\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 a44b3cfd6a..1b832ab53e 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1528,6 +1528,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.", @@ -1590,6 +1591,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 fb05de87c2..96ae9659e9 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1718,6 +1718,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", @@ -1780,6 +1781,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.", -- 2.20.1