Aude has uploaded a new change for review.

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

Change subject: Use specific summary lines in SpecialSetLabelDescriptionAliases
......................................................................

Use specific summary lines in SpecialSetLabelDescriptionAliases

This simply uses the old messages if only 1 field was changed. The
actual "change" detection is the most simple possible. I think this
is enough.

Bug: T93853
Change-Id: I6cdbd3e3dd7b1a5b9c4710d544a993b3341d1849
---
M repo/includes/specials/SpecialSetLabelDescriptionAliases.php
1 file changed, 24 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/08/199608/1

diff --git a/repo/includes/specials/SpecialSetLabelDescriptionAliases.php 
b/repo/includes/specials/SpecialSetLabelDescriptionAliases.php
index 7936811..d7d2d51 100644
--- a/repo/includes/specials/SpecialSetLabelDescriptionAliases.php
+++ b/repo/includes/specials/SpecialSetLabelDescriptionAliases.php
@@ -292,10 +292,14 @@
                $changeOps = array();
 
                if ( $this->label !== '' ) {
-                       $changeOps['wbsetlabel'] = 
$changeOpFactory->newSetLabelOp(
-                               $this->languageCode,
-                               $this->label
-                       );
+                       if ( !$fingerprint->hasLabel( $this->languageCode )
+                               || $fingerprint->getLabel( $this->languageCode 
)->getText() !== $this->label
+                       ) {
+                               $changeOps['wbsetlabel'] = 
$changeOpFactory->newSetLabelOp(
+                                       $this->languageCode,
+                                       $this->label
+                               );
+                       }
                } elseif ( $fingerprint->hasLabel( $this->languageCode ) ) {
                        $changeOps['wbsetlabel'] = 
$changeOpFactory->newRemoveLabelOp(
                                $this->languageCode
@@ -303,10 +307,14 @@
                }
 
                if ( $this->description !== '' ) {
-                       $changeOps['wbsetdescription'] = 
$changeOpFactory->newSetDescriptionOp(
-                               $this->languageCode,
-                               $this->description
-                       );
+                       if ( !$fingerprint->hasDescription( $this->languageCode 
)
+                               || $fingerprint->getDescription( 
$this->languageCode )->getText() !== $this->description
+                       ) {
+                               $changeOps['wbsetdescription'] = 
$changeOpFactory->newSetDescriptionOp(
+                                       $this->languageCode,
+                                       $this->description
+                               );
+                       }
                } elseif ( $fingerprint->hasDescription( $this->languageCode ) 
) {
                        $changeOps['wbsetdescription'] = 
$changeOpFactory->newRemoveDescriptionOp(
                                $this->languageCode
@@ -314,10 +322,14 @@
                }
 
                if ( !empty( $this->aliases ) ) {
-                       $changeOps['wbsetaliases'] = 
$changeOpFactory->newSetAliasesOp(
-                               $this->languageCode,
-                               $this->aliases
-                       );
+                       if ( !$fingerprint->hasAliasGroup( $this->languageCode )
+                               || $fingerprint->getAliasGroup( 
$this->languageCode )->getAliases() !== $this->aliases
+                       ) {
+                               $changeOps['wbsetaliases'] = 
$changeOpFactory->newSetAliasesOp(
+                                       $this->languageCode,
+                                       $this->aliases
+                               );
+                       }
                } elseif ( $fingerprint->hasAliasGroup( $this->languageCode ) ) 
{
                        $changeOps['wbsetaliases'] = 
$changeOpFactory->newRemoveAliasesOp(
                                $this->languageCode,
@@ -332,7 +344,6 @@
         * @return Summary
         */
        private function getSummaryForLabelDescriptionAliases() {
-               // FIXME: Use the existing messages if only 1 of the 3 fields 
changed.
                // FIXME: Introduce more specific messages if only 2 of the 3 
fields changed.
                $summary = new Summary( 'wbsetlabeldescriptionaliases' );
                $summary->addAutoSummaryArgs( $this->label, $this->description, 
$this->aliases );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cdbd3e3dd7b1a5b9c4710d544a993b3341d1849
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: wmf/1.25wmf22
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

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

Reply via email to