jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/362161 )

Change subject: Use rc_source in RecentChangesDuplicateDetector
......................................................................


Use rc_source in RecentChangesDuplicateDetector

rc_type = RC_EXTERNAL can be used with other external changes
than Wikibase, rc_source = 'wb' is certainly a Wikibase change.

rc_source exists since 1.23 and Wikibase already uses it for filtering
in changes lists.

Change-Id: Id4afdf2b99317394a7a49a5c38bd8b27cb1431bc
---
M client/includes/RecentChanges/RecentChangesDuplicateDetector.php
M 
client/tests/phpunit/includes/RecentChanges/RecentChangesDuplicateDetectorTest.php
2 files changed, 41 insertions(+), 2 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified
  Thiemo Mättig (WMDE): Looks good to me, but someone else must approve



diff --git a/client/includes/RecentChanges/RecentChangesDuplicateDetector.php 
b/client/includes/RecentChanges/RecentChangesDuplicateDetector.php
index dc300fc..a9ed85f 100644
--- a/client/includes/RecentChanges/RecentChangesDuplicateDetector.php
+++ b/client/includes/RecentChanges/RecentChangesDuplicateDetector.php
@@ -38,12 +38,12 @@
 
                $res = $db->select(
                        'recentchanges',
-                       array( 'rc_id', 'rc_timestamp', 'rc_type', 'rc_params' 
),
+                       array( 'rc_id', 'rc_timestamp', 'rc_source', 
'rc_params' ),
                        array(
                                'rc_namespace' => $attribs['rc_namespace'],
                                'rc_title' => $attribs['rc_title'],
                                'rc_timestamp' => $attribs['rc_timestamp'],
-                               'rc_type' => RC_EXTERNAL
+                               'rc_source' => RecentChangeFactory::SRC_WIKIBASE
                        ),
                        __METHOD__
                );
diff --git 
a/client/tests/phpunit/includes/RecentChanges/RecentChangesDuplicateDetectorTest.php
 
b/client/tests/phpunit/includes/RecentChanges/RecentChangesDuplicateDetectorTest.php
index 053e50c..b64527f 100644
--- 
a/client/tests/phpunit/includes/RecentChanges/RecentChangesDuplicateDetectorTest.php
+++ 
b/client/tests/phpunit/includes/RecentChanges/RecentChangesDuplicateDetectorTest.php
@@ -122,6 +122,25 @@
                                        )
                                ),
                        ) ),
+                       'external change exists but not from repo' => array( 
false, array(
+                               'rc_id' => 17,
+                               'rc_timestamp' => '20121212121212',
+                               'rc_user' => 23,
+                               'rc_user_text' => 'Test',
+                               'rc_namespace' => 0,
+                               'rc_title' => 'Kittens',
+                               'rc_comment' => 'Testing',
+                               'rc_type' => RC_EXTERNAL,
+                               'rc_source' => 
RecentChangeFactory::SRC_WIKIBASE,
+                               'rc_last_oldid' => 11,
+                               'rc_this_oldid' => 12,
+                               'rc_params' => array(
+                                       'wikibase-repo-change' => array(
+                                               'parent_id' => 11,
+                                               'rev_id' => 12,
+                                       )
+                               ),
+                       ) ),
                );
        }
 
@@ -222,7 +241,27 @@
                                )
                        )
                ) );
+               $change->save();
 
+               $change = $this->newChange( array(
+                       'rc_id' => 19,
+                       'rc_timestamp' => '20121212121212',
+                       'rc_user' => 23,
+                       'rc_user_text' => 'Test',
+                       'rc_namespace' => 0,
+                       'rc_title' => 'Test',
+                       'rc_comment' => 'Testing',
+                       'rc_type' => RC_EXTERNAL,
+                       'rc_source' => 'foo', // different source
+                       'rc_last_oldid' => 11,
+                       'rc_this_oldid' => 12,
+                       'rc_params' => array(
+                               'wikibase-repo-change' => array(
+                                       'parent_id' => 11,
+                                       'rev_id' => 12,
+                               )
+                       )
+               ) );
                $change->save();
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id4afdf2b99317394a7a49a5c38bd8b27cb1431bc
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to