From eba3862f2e62029ecb49466dab8a7c636bb73dc4 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Wed, 27 Nov 2024 20:39:55 +0100 Subject: diff: Load codex messagebox styles for Html::warningBox usage Bug: T380945 Change-Id: I6b87ae7ae964982998e616ed31a58c5f1decc3b7 --- includes/diff/DifferenceEngine.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'includes/diff') diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index fd2666c775f1..199767756959 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -992,6 +992,7 @@ class DifferenceEngine extends ContextSource { 'class' => 'mw-diff-revision-history-links' ], $breadCrumbs ) ); + $addMessageBoxStyles = false; # If the diff cannot be shown due to a deleted revision, then output # the diff header and links to unhide (if available)... if ( $this->shouldBeHiddenFromUser( $this->getAuthority() ) ) { @@ -1010,6 +1011,7 @@ class DifferenceEngine extends ContextSource { ]; } $out->addHTML( Html::warningBox( $this->msg( ...$msg )->parse(), 'plainlinks' ) ); + $addMessageBoxStyles = true; # Otherwise, output a regular diff... } else { # Add deletion notice if the user is viewing deleted content @@ -1017,12 +1019,14 @@ class DifferenceEngine extends ContextSource { if ( $deleted ) { $msg = $suppressed ? 'rev-suppressed-diff-view' : 'rev-deleted-diff-view'; $notice = Html::warningBox( $this->msg( $msg )->parse(), 'plainlinks' ); + $addMessageBoxStyles = true; } # Add an error if the content can't be loaded $this->getSlotContents(); foreach ( $this->getRevisionLoadErrors() as $msg ) { $notice .= Html::warningBox( $msg->parse() ); + $addMessageBoxStyles = true; } // Check if inline switcher will be needed @@ -1042,6 +1046,9 @@ class DifferenceEngine extends ContextSource { $out->addHTML( $this->markPatrolledLink() ); } } + if ( $addMessageBoxStyles ) { + $out->addModuleStyles( 'mediawiki.codex.messagebox.styles' ); + } } /** @@ -1263,6 +1270,7 @@ class DifferenceEngine extends ContextSource { ] ); } } else { + $out->addModuleStyles( 'mediawiki.codex.messagebox.styles' ); $out->addHTML( Html::errorBox( $out->parseAsInterface( -- cgit v1.2.3