mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-11 17:02:28 +00:00
Fix infinite recursion when checking for the new topic tool on empty pages
Bug: T312689 Change-Id: Iaf5033a55e3840ef65be0c4994f8b6c00fe2551b
This commit is contained in:
parent
ddaf0d1084
commit
f739160fb4
|
@ -230,7 +230,13 @@ class HookUtils {
|
|||
*/
|
||||
public static function isFeatureEnabledForOutput( OutputPage $output, ?string $feature = null ): bool {
|
||||
// Only show on normal page views (not history etc.), and in edit mode for previews
|
||||
if ( !in_array( $output->getActionName(), [ 'view', 'edit', 'submit' ] ) ) {
|
||||
if (
|
||||
// Don't try to call $output->getActionName if testing for NEWTOPICTOOL as we use
|
||||
// the hook onGetActionName to override the action for the tool on empty pages.
|
||||
// If we tried to call it here it would set up infinite recursion (T312689)
|
||||
$feature !== static::NEWTOPICTOOL &&
|
||||
!in_array( $output->getActionName(), [ 'view', 'edit', 'submit' ] )
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue