Matěj Suchánek has uploaded a new change for review.

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

Change subject: Link to target users' userpages in logs
......................................................................

Link to target users' userpages in logs

Bug: T47286
Change-Id: Ibb1eb670908bcc0ea79752134618286584f5133d
---
M i18n/en.json
M i18n/qqq.json
M includes/LogFormatter.php
3 files changed, 25 insertions(+), 17 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram 
refs/changes/73/286273/1

diff --git a/i18n/en.json b/i18n/en.json
index 79ffc9b..6d2fc2a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -73,22 +73,22 @@
        "logentry-course-remove": "$1 {{GENDER:$2|removed}} course $3",
        "logentry-course-update": "$1 {{GENDER:$2|updated}} course $3",
        "logentry-course-undelete": "$1 {{GENDER:$2|undeleted}} course $3",
-       "logentry-instructor-add": "$1 {{GENDER:$2|added}} 
{{PLURAL:$4|{{GENDER:$5|instructor}}|instructors}} $5 to course $3",
-       "logentry-instructor-remove": "$1 {{GENDER:$2|removed}} 
{{PLURAL:$4|{{GENDER:$5|instructor}}|instructors}} $5 from course $3",
+       "logentry-instructor-add": "$1 {{GENDER:$2|added}} 
{{PLURAL:$4|{{GENDER:$5|instructor}}|instructors}} $6 to course $3",
+       "logentry-instructor-remove": "$1 {{GENDER:$2|removed}} 
{{PLURAL:$4|{{GENDER:$5|instructor}}|instructors}} $6 from course $3",
        "logentry-instructor-selfadd": "$1 added 
{{GENDER:$2|himself|herself|themself}} as {{GENDER:$2|instructor}} to course 
$3",
        "logentry-instructor-selfremove": "$1 removed 
{{GENDER:$2|himself|herself|themself}} as {{GENDER:$2|instructor}} from course 
$3",
-       "logentry-online-add": "$1 {{GENDER:$2|added}} {{PLURAL:$4|Online 
{{GENDER:$5|volunteer}}|Online volunteers}} $5 to course $3",
-       "logentry-online-remove": "$1 {{GENDER:$2|removed}} {{PLURAL:$4|Online 
{{GENDER:$5|volunteer}}|Online volunteers}} $5 from course $3",
+       "logentry-online-add": "$1 {{GENDER:$2|added}} {{PLURAL:$4|Online 
{{GENDER:$5|volunteer}}|Online volunteers}} $6 to course $3",
+       "logentry-online-remove": "$1 {{GENDER:$2|removed}} {{PLURAL:$4|Online 
{{GENDER:$5|volunteer}}|Online volunteers}} $6 from course $3",
        "logentry-online-selfadd": "$1 added 
{{GENDER:$2|himself|herself|themself}} as {{GENDER:$2|Online volunteer}} to 
course $3",
        "logentry-online-selfremove": "$1 removed 
{{GENDER:$2|himself|herself|themself}} as {{GENDER:$2|Online volunteer}} from 
course $3",
        "logentry-online-profilesave": "$1 updated {{GENDER:$2|his|her|their}} 
Online volunteer profile",
-       "logentry-campus-add": "$1 {{GENDER:$2|added}} {{PLURAL:$4|Campus 
{{GENDER:$5|volunteer}}|Campus volunteers}} $5 to course $3",
-       "logentry-campus-remove": "$1 {{GENDER:$2|removed}} {{PLURAL:$4|Campus 
{{GENDER:$5|volunteer}}|Campus volunteers}} $5 from course $3",
+       "logentry-campus-add": "$1 {{GENDER:$2|added}} {{PLURAL:$4|Campus 
{{GENDER:$5|volunteer}}|Campus volunteers}} $6 to course $3",
+       "logentry-campus-remove": "$1 {{GENDER:$2|removed}} {{PLURAL:$4|Campus 
{{GENDER:$5|volunteer}}|Campus volunteers}} $6 from course $3",
        "logentry-campus-selfadd": "$1 added 
{{GENDER:$2|himself|herself|themself}} as {{GENDER:$2|Campus volunteer}} to 
course $3",
        "logentry-campus-selfremove": "$1 removed 
{{GENDER:$2|himself|herself|themself}} as {{GENDER:$2|Campus volunteer}} from 
course $3",
        "logentry-campus-profilesave": "$1 updated {{GENDER:$2|his|her|their}} 
Campus volunteer profile",
-       "logentry-student-add": "$1 {{GENDER:$2|enrolled}} $5 as 
{{PLURAL:$4|{{GENDER:$5|a student}}|students}} in course $3",
-       "logentry-student-remove": "$1 {{GENDER:$2|removed}} $5 as 
{{PLURAL:$4|{{GENDER:$5|a student}}|students}} from course $3",
+       "logentry-student-add": "$1 {{GENDER:$2|enrolled}} $6 as 
{{PLURAL:$4|{{GENDER:$5|a student}}|students}} in course $3",
+       "logentry-student-remove": "$1 {{GENDER:$2|removed}} $6 as 
{{PLURAL:$4|{{GENDER:$5|a student}}|students}} from course $3",
        "logentry-student-selfadd": "$1 {{GENDER:$2|enrolled}} in course $3",
        "logentry-student-selfremove": "$1 {{GENDER:$2|disenrolled}} from 
course $3",
        "logentry-eparticle-selfadd": "$1 added article $3 to 
{{GENDER:$2|his|her|their}} list of articles at course $4",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index f20c9ea..05068c3 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -93,22 +93,22 @@
        "logentry-course-remove": "{{logentry}}",
        "logentry-course-update": "{{logentry}}",
        "logentry-course-undelete": "{{logentry}}",
-       "logentry-instructor-add": "{{logentry}}\nAdditional parameters:\n* $4 
- the amount of added people\n* $5 - a list of added people",
-       "logentry-instructor-remove": "{{logentry}}\nAdditional parameters:\n* 
$4 - the amount of removed people\n* $5 - a list of removed people",
+       "logentry-instructor-add": "{{logentry}}\nAdditional parameters:\n* $4 
- the amount of added people\n* $5 - name of the person if they were the only 
added one\n* $6 - a list of added people",
+       "logentry-instructor-remove": "{{logentry}}\nAdditional parameters:\n* 
$4 - the amount of removed people\n* $5 - name of the person if they were the 
only removed one\n* $6 - a list of removed people",
        "logentry-instructor-selfadd": "{{doc-singularthey}}\n{{logentry}}",
        "logentry-instructor-selfremove": "{{doc-singularthey}}\n{{logentry}}",
-       "logentry-online-add": "{{logentry}}\nAdditional parameters:\n* $4 - 
the amount of added people\n* $5 - a list of added people",
-       "logentry-online-remove": "{{logentry}}\nAdditional parameters:\n* $4 - 
the amount of removed people\n* $5 - a list of removed people",
+       "logentry-online-add": "{{logentry}}\nAdditional parameters:\n* $4 - 
the amount of added people\n* $5 - name of the person if they were the only 
added one\n* $6 - a list of added people",
+       "logentry-online-remove": "{{logentry}}\nAdditional parameters:\n* $4 - 
the amount of removed people\n* $5 - name of the person if they were the only 
removed one\n* $6 - a list of removed people",
        "logentry-online-selfadd": "{{doc-singularthey}}\n{{logentry}}",
        "logentry-online-selfremove": "{{doc-singularthey}}\n{{logentry}}",
        "logentry-online-profilesave": "{{doc-singularthey}}\n{{logentry}}",
-       "logentry-campus-add": "{{logentry}}\nAdditional parameters:\n* $4 - 
the amount of added people\n* $5 - a list of added people",
-       "logentry-campus-remove": "{{logentry}}\nAdditional parameters:\n* $4 - 
the amount of removed people\n* $5 - a list of removed people",
+       "logentry-campus-add": "{{logentry}}\nAdditional parameters:\n* $4 - 
the amount of added people\n* $5 - name of the person if they were the only 
added one\n* $6 - a list of added people",
+       "logentry-campus-remove": "{{logentry}}\nAdditional parameters:\n* $4 - 
the amount of removed people\n* $5 - name of the person if they were the only 
removed one\n* $6 - a list of removed people",
        "logentry-campus-selfadd": "{{doc-singularthey}}\n{{logentry}}",
        "logentry-campus-selfremove": "{{doc-singularthey}}\n{{logentry}}",
        "logentry-campus-profilesave": "{{doc-singularthey}}\n{{logentry}}",
-       "logentry-student-add": "{{logentry}}\n* $4 is the number of students 
who were enrolled.\n* $5 is the gender of a the student, if only one student 
was enrolled.",
-       "logentry-student-remove": "{{logentry}}\nAdditional parameters:\n* $4 
- the number of added/removed people\n* $5 - a list of added/removed people",
+       "logentry-student-add": "{{logentry}}\nAdditional parameters:\n* $4 - 
the number of students who were enrolled.\n* $5 - the name of the student if 
they were the only enrolled one.\n* $6 - a list of enrolled students",
+       "logentry-student-remove": "{{logentry}}\nAdditional parameters:\n* $4 
- the number of students who were disenrolled.\n* $5 - the name of the student 
if they were the only disenrolled one.\n* $6 - a list of disenrolled students",
        "logentry-student-selfadd": "{{logentry}}",
        "logentry-student-selfremove": "{{logentry}}",
        "logentry-eparticle-selfadd": 
"{{doc-singularthey}}\n{{logentry}}\nAdditional parameters:\n* $4 - the course",
diff --git a/includes/LogFormatter.php b/includes/LogFormatter.php
index 8c6352f..cd5c198 100644
--- a/includes/LogFormatter.php
+++ b/includes/LogFormatter.php
@@ -62,6 +62,13 @@
 class RoleChangeFormatter extends LogFormatter {
 
        /**
+        * Helper callback for extractParameters
+        */
+       private function formatUsername( $value ) {
+               return $this->formatParameterValue( 'user-link', $value );
+       }
+
+       /**
         * @see LogFormatter::extractParameters()
         */
        protected function extractParameters() {
@@ -70,8 +77,9 @@
                if ( !empty( $params ) ) {
                        $lang = $this->context->getLanguage();
 
+                       $params[5] = $lang->listToText( array_map( 
$this->formatUsername, (array)$params[4] ) );
+                       $params[4] = $params[3] > 1 ? '' : (string)$params[4];
                        $params[3] = $lang->formatNum( $params[3] );
-                       $params[4] = $lang->listToText( (array)$params[4] );
                }
 
                return $params;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb1eb670908bcc0ea79752134618286584f5133d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <[email protected]>

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

Reply via email to