Ladsgroup has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378955 )

Change subject: Fix undoing merge operations that turned Items into a redirects
......................................................................

Fix undoing merge operations that turned Items into a redirects

This is a regression introduced with https://gerrit.wikimedia.org/r/377298
Reverts always worked, but undos only worked because of the optimization that
was removed.

Bug: T175984
Change-Id: I9fd3a60fbe90f16bb3eb5140c5fe86021587215c
---
M repo/includes/Content/EntityContent.php
M repo/tests/phpunit/includes/Content/EntityContentTest.php
2 files changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/repo/includes/Content/EntityContent.php 
b/repo/includes/Content/EntityContent.php
index 7464ed2..230a062 100644
--- a/repo/includes/Content/EntityContent.php
+++ b/repo/includes/Content/EntityContent.php
@@ -571,6 +571,7 @@
 
                if ( $this->isRedirect() ) {
                        $entityAfterPatch = $this->makeEmptyEntity();
+                       $entityAfterPatch->setId( $this->getEntityId() );
                } else {
                        $entityAfterPatch = $this->getEntity()->copy();
                }
diff --git a/repo/tests/phpunit/includes/Content/EntityContentTest.php 
b/repo/tests/phpunit/includes/Content/EntityContentTest.php
index b12c2ec..9baef09 100644
--- a/repo/tests/phpunit/includes/Content/EntityContentTest.php
+++ b/repo/tests/phpunit/includes/Content/EntityContentTest.php
@@ -362,6 +362,8 @@
 
                if ( $expected !== null ) {
                        $this->assertTrue( $expected->equals( $actual ), 
'equals()' );
+                       // Warning, the equals above does not compare the IDs 
of non-redirects!
+                       $this->assertEquals( $expected->getEntityId(), 
$actual->getEntityId() );
                }
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9fd3a60fbe90f16bb3eb5140c5fe86021587215c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: wmf/1.30.0-wmf.18
Gerrit-Owner: Ladsgroup <ladsgr...@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