Ppchelko has uploaded a new change for review.

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

Change subject: Don't set added/removed properties if they are empty
......................................................................

Don't set added/removed properties if they are empty

Change-Id: I7285c81e66ef98611eb3dc1bdeeb47ef7d508a04
---
M EventBus.hooks.php
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventBus 
refs/changes/20/315520/1

diff --git a/EventBus.hooks.php b/EventBus.hooks.php
index 7ea0877..ee3a733 100644
--- a/EventBus.hooks.php
+++ b/EventBus.hooks.php
@@ -653,13 +653,17 @@
                        'page_title'         => $title->getPrefixedDBkey(),
                        'page_namespace'     => $title->getNamespace(),
                        'page_is_redirect'   => $title->isRedirect(),
-                       'rev_id'             =>$revision->getId(),
-
-                       // page properties change specific fields:
-                       'added_properties' => $addedProps,
-                       'removed_properties' => $removedProps
+                       'rev_id'             =>$revision->getId()
                ];
 
+               if ( !empty( $addedProps ) ) {
+                       $attrs[ 'added_properties' ] = $addedProps;
+               }
+
+               if ( !empty( $removedProps ) ) {
+                       $attrs[ 'removed_properties' ] = $removedProps;
+               }
+
                $events[] = self::createEvent(
                        self::getArticleURL( $linksUpdate->getTitle() ),
                        'mediawiki.page-properties-change',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7285c81e66ef98611eb3dc1bdeeb47ef7d508a04
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventBus
Gerrit-Branch: wmf/1.28.0-wmf.22
Gerrit-Owner: Ppchelko <ppche...@wikimedia.org>

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

Reply via email to