[MediaWiki-commits] [Gerrit] mediawiki...EventBus[master]: Only set the comment field if the comment is non-null.
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/404897 ) Change subject: Only set the comment field if the comment is non-null. .. Only set the comment field if the comment is non-null. For null comments we shouldn't set the field cause it's not required, but the event validation fails if we set it to null. Change-Id: I97a2b87f268e40beca5cee48c8d824c6f9aa75a2 --- M EventBus.hooks.php 1 file changed, 11 insertions(+), 9 deletions(-) Approvals: Mobrovac: Looks good to me, approved jenkins-bot: Verified diff --git a/EventBus.hooks.php b/EventBus.hooks.php index 4b11438..ef25a51 100644 --- a/EventBus.hooks.php +++ b/EventBus.hooks.php @@ -155,7 +155,6 @@ // Common Mediawiki entity fields 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $user ), - 'comment'=> $reason, // page entity fields 'page_id'=> $id, @@ -174,6 +173,7 @@ } if ( !is_null( $reason ) ) { + $attrs['comment'] = $reason; $attrs['parsedcomment'] = Linker::formatComment( $reason, $wikiPage->getTitle() ); } @@ -211,7 +211,6 @@ // Common Mediawiki entity fields 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $performer ), - 'comment'=> $comment, // page entity fields 'page_id'=> $title->getArticleID(), @@ -236,6 +235,7 @@ } if ( !is_null( $comment ) ) { + $attrs['comment'] = $comment; $attrs['parsedcomment'] = Linker::formatComment( $comment, $title ); } @@ -280,7 +280,6 @@ // Common Mediawiki entity fields 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $user ), - 'comment'=> $reason, // page entity fields 'page_id'=> $pageid, @@ -312,6 +311,7 @@ } if ( !is_null( $reason ) ) { + $attrs['comment'] = $reason; $attrs['parsedcomment'] = Linker::formatComment( $reason, $newTitle ); } @@ -376,7 +376,6 @@ // Common Mediawiki entity fields: 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $performer ), - 'comment'=> $revision->getComment(), // revision entity fields: 'page_id'=> $revision->getPage(), @@ -407,10 +406,10 @@ $attrs['page_is_redirect'] = false; } - if ( !is_null( $revision->getComment() ) ) { - $attrs['parsedcomment'] = Linker::formatComment( - $revision->getComment(), - $revision->getTitle() ); + $comment = $revision->getComment(); + if ( !is_null( $comment ) ) { + $attrs['comment'] = $comment; + $attrs['parsedcomment'] = Linker::formatComment( $comment, $revision->getTitle() ); } $events[] = EventBus::createEvent( @@ -544,9 +543,12 @@ // Common Mediawiki entity fields: 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $user ), - 'comment'=> $block->mReason, ]; + if ( !is_null( $block->mReason ) ) { + $attrs['comment'] = $block->mReason; + } + // user entity fields: // Note that, except for null, it is always safe to treat the target -- To view, visit https://gerrit.wikimedia.org/r/404897 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I97a2b87f268e40beca5cee48c8d824c6f9aa75a2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/EventBus Gerrit-Branch: master Gerri
[MediaWiki-commits] [Gerrit] mediawiki...EventBus[master]: Only set the comment field if the comment is non-null.
Ppchelko has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404897 ) Change subject: Only set the comment field if the comment is non-null. .. Only set the comment field if the comment is non-null. For null comments we shouldn't set the field cause it's not required, but the event validation fails if we set it to null. Change-Id: I97a2b87f268e40beca5cee48c8d824c6f9aa75a2 --- M EventBus.hooks.php 1 file changed, 11 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventBus refs/changes/97/404897/1 diff --git a/EventBus.hooks.php b/EventBus.hooks.php index 4b11438..ef25a51 100644 --- a/EventBus.hooks.php +++ b/EventBus.hooks.php @@ -155,7 +155,6 @@ // Common Mediawiki entity fields 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $user ), - 'comment'=> $reason, // page entity fields 'page_id'=> $id, @@ -174,6 +173,7 @@ } if ( !is_null( $reason ) ) { + $attrs['comment'] = $reason; $attrs['parsedcomment'] = Linker::formatComment( $reason, $wikiPage->getTitle() ); } @@ -211,7 +211,6 @@ // Common Mediawiki entity fields 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $performer ), - 'comment'=> $comment, // page entity fields 'page_id'=> $title->getArticleID(), @@ -236,6 +235,7 @@ } if ( !is_null( $comment ) ) { + $attrs['comment'] = $comment; $attrs['parsedcomment'] = Linker::formatComment( $comment, $title ); } @@ -280,7 +280,6 @@ // Common Mediawiki entity fields 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $user ), - 'comment'=> $reason, // page entity fields 'page_id'=> $pageid, @@ -312,6 +311,7 @@ } if ( !is_null( $reason ) ) { + $attrs['comment'] = $reason; $attrs['parsedcomment'] = Linker::formatComment( $reason, $newTitle ); } @@ -376,7 +376,6 @@ // Common Mediawiki entity fields: 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $performer ), - 'comment'=> $revision->getComment(), // revision entity fields: 'page_id'=> $revision->getPage(), @@ -407,10 +406,10 @@ $attrs['page_is_redirect'] = false; } - if ( !is_null( $revision->getComment() ) ) { - $attrs['parsedcomment'] = Linker::formatComment( - $revision->getComment(), - $revision->getTitle() ); + $comment = $revision->getComment(); + if ( !is_null( $comment ) ) { + $attrs['comment'] = $comment; + $attrs['parsedcomment'] = Linker::formatComment( $comment, $revision->getTitle() ); } $events[] = EventBus::createEvent( @@ -544,9 +543,12 @@ // Common Mediawiki entity fields: 'database' => $wgDBname, 'performer' => EventBus::createPerformerAttrs( $user ), - 'comment'=> $block->mReason, ]; + if ( !is_null( $block->mReason ) ) { + $attrs['comment'] = $block->mReason; + } + // user entity fields: // Note that, except for null, it is always safe to treat the target -- To view, visit https://gerrit.wikimedia.org/r/404897 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I97a2b87f268e40beca5cee48c8d824c6f9aa75a2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/EventBus Gerrit-Bra