jenkins-bot has submitted this change and it was merged.

Change subject: Fix Fatal error in recent changes
......................................................................


Fix Fatal error in recent changes

When displaying grouped header edits the formatter code was attempting
to clone a non-existant topic link. Patch updates to fall back to a
'workflow' link if the topic is not available.  Further falls back
to throwing an exception instead of fataling.

Bug: T92536
Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
---
M includes/Formatter/RecentChanges.php
1 file changed, 13 insertions(+), 6 deletions(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Formatter/RecentChanges.php 
b/includes/Formatter/RecentChanges.php
index 4cb94d2..b5817cf 100644
--- a/includes/Formatter/RecentChanges.php
+++ b/includes/Formatter/RecentChanges.php
@@ -176,13 +176,20 @@
                        throw new FlowException( 'Could not format data for row 
' . $row->revision->getRevisionId()->getAlphadecimal() );
                }
 
-               // add highlight details to anchor
-               /** @var Anchor $anchor */
-               $anchor = clone $data['links']['topic'];
-               $anchor->query['fromnotif'] = '1';
-               $anchor->fragment = '#flow-post-' . $oldId->getAlphadecimal();
+               if ( isset( $data['links']['topic'] ) ) {
+                       // add highlight details to anchor
+                       /** @var Anchor $anchor */
+                       $anchor = clone $data['links']['topic'];
+                       $anchor->query['fromnotif'] = '1';
+                       $anchor->fragment = '#flow-post-' . 
$oldId->getAlphadecimal();
+               } elseif ( isset( $data['links']['workflow'] ) ) {
+                       $anchor = $data['links']['workflow'];
+               } else {
+                       // this will be caught and logged by the RC hook, it 
will not fatal the page.
+                       throw new FlowException( "No anchor available for 
revision $oldId" );
+               }
 
-               $changes = count($block);
+               $changes = count( $block );
                // link text: "n changes"
                $text = $ctx->msg( 'nchanges' )->numParams( $changes 
)->escaped();
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: SG <shah...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to