jenkins-bot has submitted this change and it was merged.
Change subject: Handle miscounting of coalesced changes in client recent changes
......................................................................
Handle miscounting of coalesced changes in client recent changes
This normalises the count of coalesced changes.
In several months, the "normalisation" can be removed as such entries
will eventually be purged from recent changes table on Wikidata.
Bug: 45812
Change-Id: I4c82c610d2316450451fe97d0f490e0342f9d4e9
---
M client/includes/recentchanges/ExternalChangeFactory.php
1 file changed, 15 insertions(+), 1 deletion(-)
Approvals:
WikidataJenkins: Verified
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/client/includes/recentchanges/ExternalChangeFactory.php
b/client/includes/recentchanges/ExternalChangeFactory.php
index 900f06c..12d514c 100644
--- a/client/includes/recentchanges/ExternalChangeFactory.php
+++ b/client/includes/recentchanges/ExternalChangeFactory.php
@@ -192,7 +192,7 @@
// Combine all the comments! Up to some max length?
if ( array_key_exists( 'composite-comment', $changeParams ) ) {
$comment['key'] = 'wikibase-comment-multi';
- $comment['numparams'] = count(
$changeParams['composite-comment'] );
+ $comment['numparams'] = $this->countCompositeComments(
$changeParams['composite-comment'] );
} elseif ( array_key_exists( 'comment', $changeParams ) ) {
$comment = $this->parseComment(
$changeParams['comment'], $changeParams['type'] );
}
@@ -200,4 +200,18 @@
return $comment;
}
+ /**
+ * normalizes for extra empty comment in rc_params (see bug 45812)
+ * @fixme: can remove at some point in the future
+ *
+ * @param array $comments
+ *
+ * @return int
+ */
+ private function countCompositeComments( $comments ) {
+ $compositeComments = array_filter( $comments );
+
+ return count( $compositeComments );
+ }
+
}
--
To view, visit https://gerrit.wikimedia.org/r/120805
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4c82c610d2316450451fe97d0f490e0342f9d4e9
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: WikidataJenkins <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits