Don't show the diff-mode selector if not viewing a diff

The DifferenceEngineBeforeDiffTable hook is run when viewing a
diff after switching from visual to source editing, but the
mode selection widget shouldn't be shown then.

Bug: T324759
Change-Id: Ieb8a1b77928201a45635af46635b902cac01a36d
This commit is contained in:
Sam Wilson 2023-05-04 15:20:51 +08:00 committed by HMonroy
parent 285a5399e4
commit 00abad4861

View file

@ -148,7 +148,10 @@ class Hooks implements DifferenceEngineBeforeDiffTableHook {
->makeConfig( 'visualeditor' );
$output = RequestContext::getMain()->getOutput();
if ( !ApiVisualEditor::isAllowedContentType( $veConfig, $diff->getTitle()->getContentModel() ) ) {
// Return early if not viewing a diff of an allowed type.
if ( !ApiVisualEditor::isAllowedContentType( $veConfig, $diff->getTitle()->getContentModel() )
|| $output->getActionName() !== 'view'
) {
return;
}