jenkins-bot has submitted this change and it was merged.

Change subject: Move "see more images" to i18n
......................................................................


Move "see more images" to i18n

Also fixes an unrelated bug in the content code.

Bug: T145448
Change-Id: I7a544dfc424df0ef9b62982450cf2b9a69a0b8a1
---
M ApiFileAnnotations.php
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/FileAnnotationsContent.php
M resources/src/fileannotations.js
6 files changed, 17 insertions(+), 5 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 73dafbd..c21f397 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -138,9 +138,8 @@
 
                                $imagesHtml .= '</div>';
 
-                               // @FIXME: i18n!
                                $seeMoreHtml = $pages
-                                       ? '<a href="' . $href . '">' . 'See 
more images' . '</a>'
+                                       ? '<a class="commons-see-more" href="' 
. $href . '"></a>'
                                        : '';
 
                                $html =
diff --git a/extension.json b/extension.json
index dbde3c7..93aa6a6 100644
--- a/extension.json
+++ b/extension.json
@@ -62,7 +62,8 @@
                                "save-fileannotation",
                                "cancel-fileannotation",
                                "edit-fileannotation",
-                               "delete-fileannotation"
+                               "delete-fileannotation",
+                               "fileannotations-commons-see-more"
                        ]
                }
        },
diff --git a/i18n/en.json b/i18n/en.json
index 9b7a627..63b3194 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -11,6 +11,8 @@
        "edit-fileannotation": "Edit",
        "delete-fileannotation": "Delete",
 
+       "fileannotations-commons-see-more": "See more images",
+
        "fileannotations-go-to-filepage": "It is recommended that you view and 
edit file annotations on [[:$1|the file page]], where they are available in a 
visual format.",
 
        "apihelp-query+fileannotations-description": "Fetch wikitext and 
optionally HTML for annotations on a file on the wiki.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4dedd17..af7289f 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -10,5 +10,6 @@
        "cancel-fileannotation": "Text of a button that cancels creating or 
editing an annotation.",
        "edit-fileannotation": "Text of a button to begin editing an 
annotation.",
        "delete-fileannotation": "Text of a button to delete an annotation.",
+       "fileannotations-commons-see-more": "Shown on an annotation that is a 
Commons category, allows the user to go to the category page to see more 
images.",
        "fileannotations-go-to-filepage": "Appears on the file annotations page 
to encourage users to go to the file page to interact with the content. $1 is 
the file page title, including namespace, suitable for inclusion in a wikilink. 
The message will be parsed. Remember to put a colon (:) in front of the file 
page title, or the message will put the whole image into the page."
 }
diff --git a/includes/FileAnnotationsContent.php 
b/includes/FileAnnotationsContent.php
index 85fccc3..9b50a8a 100644
--- a/includes/FileAnnotationsContent.php
+++ b/includes/FileAnnotationsContent.php
@@ -36,10 +36,16 @@
 
                $arrayAnnotations = (array) $annotations;
 
-               foreach ( $arrayAnnotations['annotations'] as $i => $annotation 
) {
-                       $arrayAnnotations['annotations'][$i] = (array) 
$annotation;
+               $allAnnotations = isset( $arrayAnnotations['annotations'] )
+                       ? $arrayAnnotations['annotations']
+                       : [];
+
+               foreach ( $allAnnotations as $i => $annotation ) {
+                       $allAnnotations[$i] = (array) $annotation;
                }
 
+               $arrayAnnotations['annotations'] = $allAnnotations;
+
                return EventLogging::schemaValidate( $arrayAnnotations, $schema 
);
        }
 
diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 5597b16..1fb0ec4 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -386,6 +386,9 @@
                        $annotation
                );
 
+               $( '.commons-category-annotation .commons-see-more' )
+                       .msg( 'fileannotations-commons-see-more' );
+
                if ( this.editing ) {
                        editButton = new OO.ui.ButtonWidget( {
                                label: mw.message( 'edit-fileannotation' 
).text(),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7a544dfc424df0ef9b62982450cf2b9a69a0b8a1
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <mholmqu...@wikimedia.org>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: MarkTraceur <mholmqu...@wikimedia.org>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to