mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
Ensure an array is passed to ApiEchoMute::lookupIds()
The nicer approach would be setting the parameter default to [], but that breaks ApiSandbox. Bug: T254699 Change-Id: I6c553e27248ff7d6c696f116cb34eb238dade440
This commit is contained in:
parent
ea200ace05
commit
153db72ec4
|
@ -32,16 +32,18 @@ class ApiEchoMute extends ApiBase {
|
|||
$mutelistInfo = self::$muteLists[ $params['type'] ];
|
||||
$prefValue = $user->getOption( $mutelistInfo['pref'] );
|
||||
$ids = $this->parsePref( $prefValue, $mutelistInfo['type'] );
|
||||
$targetsToMute = $params['mute'] ?? [];
|
||||
$targetsToUnmute = $params['unmute'] ?? [];
|
||||
|
||||
$changed = false;
|
||||
$addIds = $this->lookupIds( $params['mute'], $mutelistInfo['type'] );
|
||||
$addIds = $this->lookupIds( $targetsToMute, $mutelistInfo['type'] );
|
||||
foreach ( $addIds as $id ) {
|
||||
if ( !in_array( $id, $ids ) ) {
|
||||
$ids[] = $id;
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
$removeIds = $this->lookupIds( $params['unmute'], $mutelistInfo['type'] );
|
||||
$removeIds = $this->lookupIds( $targetsToUnmute, $mutelistInfo['type'] );
|
||||
foreach ( $removeIds as $id ) {
|
||||
$index = array_search( $id, $ids );
|
||||
if ( $index !== false ) {
|
||||
|
|
Loading…
Reference in a new issue