Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/240736

Change subject: UploadWizardDetails: Remove broken updateCopyMsgs() function
......................................................................

UploadWizardDetails: Remove broken updateCopyMsgs() function

There are at least four separate reasons why this code does not work.
Can you find them all, dear reader?

* Remove documentation and {{PLURAL:}} checks for message parameters
  which were either never passed or hardcoded to a single value.
  This should fall back nicely to the plural form until the
  translations are updated.
* Add a list of messages used in buildAndShowCopyMetadata().

Change-Id: I896f2ea10e0f54b947a6d18ea0e6292da8cc79c0
---
M i18n/en.json
M i18n/qqq.json
M resources/mw.UploadWizardDetails.js
3 files changed, 9 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/36/240736/1

diff --git a/i18n/en.json b/i18n/en.json
index 5d85b5f..d8e147c 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -123,13 +123,13 @@
        "mwe-upwiz-source-thirdparty-accept": "OK",
        "mwe-upwiz-source-custom": "Provide copyright information for each file 
individually on the next page.",
        "mwe-upwiz-more-options": "Add location and more information ...",
-       "mwe-upwiz-copy-metadata": "Copy information to {{PLURAL:$1|the other 
upload|all uploads}} following ...",
+       "mwe-upwiz-copy-metadata": "Copy information to all uploads following 
...",
        "mwe-upwiz-copy-metadata-button": "Copy",
        "mwe-upwiz-copied-metadata-button": "Successfully Copied",
        "mwe-upwiz-copy-title": "Copy title (with automatic numbering)",
-       "mwe-upwiz-copy-description": "Copy 
{{PLURAL:$1|description|descriptions}}",
+       "mwe-upwiz-copy-description": "Copy descriptions",
        "mwe-upwiz-copy-date": "Copy date",
-       "mwe-upwiz-copy-categories": "Copy {{PLURAL:$1|category|categories}}",
+       "mwe-upwiz-copy-categories": "Copy categories",
        "mwe-upwiz-copy-location": "Copy location",
        "mwe-upwiz-copy-other": "Copy other information",
        "mwe-upwiz-desc": "Description",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 18fd1bd..7fcc433 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -146,13 +146,13 @@
        "mwe-upwiz-source-thirdparty-accept": "{{Identical|OK}}",
        "mwe-upwiz-source-custom": "Prompts the user for the copyright 
information for each file.",
        "mwe-upwiz-more-options": "Text for a 'more options' toggle that opens 
more of a form so a user can make more detailed descriptions/add more 
properties for uploaded images.",
-       "mwe-upwiz-copy-metadata": "Toggler which expands/collapses a selection 
of checkboxes vertically which allow the user to selectively copy metadata from 
the first upload to other uploads.\n\nParameters:\n* $1 - number of uploads",
+       "mwe-upwiz-copy-metadata": "Toggler which expands/collapses a selection 
of checkboxes vertically which allow the user to selectively copy metadata from 
the first upload to other uploads.",
        "mwe-upwiz-copy-metadata-button": "Label of the button which executes a 
copy operation of selected metadata from the first upload to all other 
uploads.\n{{Identical|Copy}}",
        "mwe-upwiz-copied-metadata-button": "Label of the button which executes 
a copy operation of selected metadata from the first upload to all other 
uploads after successfully completing the operation.",
        "mwe-upwiz-copy-title": "Label for the checkbox to copy title from the 
first upload to other uploads, with an automatically added or increased unique 
numeric identifier.",
-       "mwe-upwiz-copy-description": "Label for checkbox to copy selected 
metadata from the first upload to other uploads. $1 is the number of 
descriptions.",
+       "mwe-upwiz-copy-description": "Label for checkbox to copy selected 
metadata from the first upload to other uploads.",
        "mwe-upwiz-copy-date": "Label for checkbox to copy selected metadata 
from the first upload to other uploads.",
-       "mwe-upwiz-copy-categories": "Label for checkbox to copy selected 
metadata from the first upload to other uploads. $1 is the number of categories 
to copy.",
+       "mwe-upwiz-copy-categories": "Label for checkbox to copy selected 
metadata from the first upload to other uploads.",
        "mwe-upwiz-copy-location": "Label for checkbox to copy selected 
metadata from the first upload to other uploads.",
        "mwe-upwiz-copy-other": "Label for checkbox to copy selected metadata 
from the first upload to other uploads.",
        "mwe-upwiz-desc": "[[File:Commons-uw-L52P.png|right|thumb|Screenshot 
showing a sample of this message]]\n\nThis is followed by a language name in a 
drop-down language selector.\n{{Identical|Description}}",
diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index df1c406..5366d30 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -446,7 +446,6 @@
                        missingCatsWikiText: missingCatsWikiText,
                        willbeaddedtext: mw.message( 
'mwe-upwiz-category-will-be-added' ).text(),
                        onnewcat: function () {
-                               details.updateCopyMsgs();
                        }
                } );
        };
@@ -485,7 +484,6 @@
                        if ( !this.isAttached ) {
                                $( this.containerDiv ).append( this.div );
                                this.isAttached = true;
-                               this.updateCopyMsgs();
                        }
                },
 
@@ -794,13 +792,11 @@
 
                        $.each( this.copyMetadataTypes, function ( 
metadataName, defaultStatus ) {
                                var copyMetadataMsg, checkbox, field,
+                                       // mwe-upwiz-copy-title, 
mwe-upwiz-copy-description, mwe-upwiz-copy-date,
+                                       // mwe-upwiz-copy-categories, 
mwe-upwiz-copy-location, mwe-upwiz-copy-other
                                        copyMessage = 'mwe-upwiz-copy-' + 
metadataName;
 
-                               if ( metadataName === 'description' || 
metadataName === 'categories' ) {
-                                       copyMetadataMsg = mw.message( 
copyMessage, 1 ).text();
-                               } else {
-                                       copyMetadataMsg = mw.message( 
copyMessage ).text();
-                               }
+                               copyMetadataMsg = mw.message( copyMessage 
).text();
 
                                checkbox = new OO.ui.CheckboxInputWidget( {
                                        selected: defaultStatus
@@ -856,33 +852,6 @@
                        var mapLink = new mw.Uri( 
'https://www.openstreetmap.org/' )
                                .extend( { zoom: 9, mlat: 
this.$latitudeInput.val(), mlon: this.$longitudeInput.val() } );
                        return mapLink.toString();
-               },
-
-               /**
-                * Update messages in copyMetadata div
-                */
-               updateCopyMsgs: function () {
-                       var $lbl,
-                               msgs = [
-                                       {
-                                               title: 
'mwe-upwiz-copy-description',
-                                               counter: function () {
-                                                       return $( 
'.mwe-upwiz-details-fieldname', this.$form ).length;
-                                               }
-                                       },
-                                       {
-                                               title: 
'mwe-upwiz-copy-categories',
-                                               counter: function () {
-                                                       return $( 'ul li.cat, 
.categoryInput', this.$form ).length;
-                                               }
-                                       }
-                               ];
-                       $.each( msgs, function ( index, msg ) {
-                               var $lbl = $( 'label[for="' + msg.title + '"]' 
);
-                               $lbl.text( mw.message( msg.title, msg.counter() 
).text() );
-                       } );
-                       $lbl = $( '.mwe-upwiz-details-copy-metadata a', 
this.$form );
-                       $lbl.text( mw.message( 'mwe-upwiz-copy-metadata', 
this.upload.wizard.uploads.length - 1 ).text() );
                },
 
                /**
@@ -1137,7 +1106,6 @@
 
                        this.descriptions.push( description );
                        this.recountDescriptions();
-                       this.updateCopyMsgs();
                },
 
                /**
@@ -1155,14 +1123,12 @@
                        );
 
                        this.recountDescriptions();
-                       this.updateCopyMsgs();
                },
 
                removeAllDescriptions: function () {
                        $( this.descriptionsDiv ).children().remove();
                        this.descriptions = [];
                        this.recountDescriptions();
-                       this.updateCopyMsgs();
                },
 
                /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I896f2ea10e0f54b947a6d18ea0e6292da8cc79c0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

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

Reply via email to