Go to the documentation of this file.
51 $this->enableUserEmailBlacklist = $config->get(
'EnableUserEmailBlacklist' );
52 $this->enableUserEmail = $config->get(
'EnableUserEmail' );
56 parent::__construct( self::PAGE_NAME,
'',
false );
68 parent::execute(
$par );
71 $out->addModules(
'mediawiki.misc-authed-ooui' );
93 $out->addWikiMsg(
'specialmute-success' );
103 foreach ( $data as $userOption => $value ) {
110 $hookData[$userOption][
'after'] = (bool)$value;
114 Hooks::run(
'SpecialMuteSubmit', [ $hookData ] );
123 return $this->
msg(
'specialmute' )->text();
134 $key = array_search( $this->targetCentralId, $blacklist );
135 if ( $key !==
false ) {
136 unset( $blacklist[$key] );
137 $blacklist = implode(
"\n", $blacklist );
140 $user->setOption( $userOption, $blacklist );
141 $user->saveSettings();
155 $blacklist = implode(
"\n", $blacklist );
158 $user->setOption( $userOption, $blacklist );
159 $user->saveSettings();
167 $form = parent::getForm();
168 $form->setId(
'mw-specialmute-form' );
169 $form->setHeaderText( $this->
msg(
'specialmute-header', $this->target )->parse() );
170 $form->setSubmitTextMsg(
'specialmute-submit' );
171 $form->setSubmitID(
'save' );
182 $this->enableUserEmailBlacklist &&
183 $this->enableUserEmail &&
184 $this->
getUser()->getEmailAuthenticationTimestamp()
186 $fields[
'email-blacklist'] = [
188 'label-message' =>
'specialmute-label-mute-email',
193 Hooks::run(
'SpecialMuteModifyFormFields', [ $this, &$fields ] );
195 if ( count( $fields ) == 0 ) {
196 throw new ErrorPageError(
'specialmute',
'specialmute-error-no-options' );
208 throw new ErrorPageError(
'specialmute',
'specialmute-error-invalid-user' );
211 $this->targetCentralId = $this->centralIdLookup->centralIdFromLocalUser(
$target );
221 return in_array( $this->targetCentralId, $blacklist,
true );
229 $blacklist = $this->
getUser()->getOption( $userOption );
234 return MultiUsernameFilter::splitIds( $blacklist );
muteTarget( $userOption)
Mute target.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getId()
Get the user's ID.
getOutput()
Get the OutputPage being used for this instance.
isTargetBlacklisted( $userOption)
CentralIdLookup $centralIdLookup
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
Special page which uses an HTMLForm to handle processing.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
getDisplayFormat()
Get display format for the form.See HTMLForm documentation for available values.1....
A special page that allows users to modify their notification preferences.
requiresUnblock()
Whether this action cannot be executed by a blocked user.bool
unmuteTarget( $userOption)
Un-mute target.
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
getUser()
Shortcut to get the User executing this instance.
string null $par
The sub-page of the special page.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
onSubmit(array $data, HTMLForm $form=null)
getFormFields()
Get an HTMLForm descriptor array.array
bool $enableUserEmailBlacklist
execute( $par)
Entry point for special pages.
static getMain()
Get the RequestContext object associated with the main request.
The CentralIdLookup service allows for connecting local users with cluster-wide IDs.
getBlacklist( $userOption)
An error page which can definitely be safely rendered using the OutputPage.
static factory( $providerId=null)
Fetch a CentralIdLookup.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getForm()
Get the HTMLForm to control behavior.HTMLForm|null