special: Check login permissions before calling execute method

Calling the parent method first means the form has to be built (as
well as various other things) and then it cannot be shown because
of permission and the user is redirected.

This also lead to confusing behavior where some code paths are
reached even though the user cannot actually access the page.

Change-Id: If354d98f9e51acef38cac114a7704d28c148017b
This commit is contained in:
Ammarpad 2024-10-23 21:09:12 +01:00
parent a76cc44a60
commit 4303ab5f71

View file

@ -25,13 +25,13 @@ class SpecialNotificationsMarkRead extends FormSpecialPage {
}
public function execute( $par ) {
// Redirect to login page and inform user of the need to login
$this->requireLogin( 'echo-notification-loginrequired' );
parent::execute( $par );
$out = $this->getOutput();
$out->setPageTitleMsg( $this->msg( 'echo-specialpage-markasread' ) );
// Redirect to login page and inform user of the need to login
$this->requireLogin( 'echo-notification-loginrequired' );
}
public function isListed() {