X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdiff%2FDifferenceEngine.php;h=037a80fbc7f55ccf9d4e0599987f083c3dd71899;hb=c35b81bda40abd7f8a1bb022f9d4a2ae9b3e7afb;hp=51b9f15a60d3dc5d2907e73c27487732a0375766;hpb=587d08c5a626f8195def9f82ee83e17c85824db8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 51b9f15a60..037a80fbc7 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -634,7 +634,10 @@ class DifferenceEngine extends ContextSource { if ( Hooks::run( 'DifferenceEngineRenderRevisionAddParserOutput', [ $this, $out, $parserOutput, $wikiPage ] ) ) { - $out->addParserOutput( $parserOutput ); + $out->addParserOutput( $parserOutput, [ + 'enableSectionEditLinks' => $this->mNewRev->isCurrent() + && $this->mNewRev->getTitle()->quickUserCan( 'edit', $this->getUser() ), + ] ); } } } @@ -647,13 +650,14 @@ class DifferenceEngine extends ContextSource { } } + /** + * @param WikiPage $page + * @param Revision $rev + * + * @return ParserOutput|bool False if the revision was not found + */ protected function getParserOutput( WikiPage $page, Revision $rev ) { $parserOptions = $page->makeParserOptions( $this->getContext() ); - - if ( !$rev->isCurrent() || !$rev->getTitle()->quickUserCan( 'edit', $this->getUser() ) ) { - $parserOptions->setEditSection( false ); - } - $parserOutput = $page->getParserOutput( $parserOptions, $rev->getId() ); return $parserOutput; @@ -1290,7 +1294,7 @@ class DifferenceEngine extends ContextSource { if ( !$diff && !$otitle ) { $header .= " - + {$ntitle} "; $multiColspan = 1; @@ -1309,7 +1313,7 @@ class DifferenceEngine extends ContextSource { } if ( $otitle || $ntitle ) { $header .= " - + {$otitle} {$ntitle} "; @@ -1317,12 +1321,12 @@ class DifferenceEngine extends ContextSource { } if ( $multi != '' ) { - $header .= "{$multi}"; } if ( $notice != '' ) { - $header .= "{$notice}"; + $header .= "{$notice}"; } return $header . $diff . "";