Commit 85c564d3 authored by Alexia's avatar Alexia
Browse files

Fix other usage of CentralIdLookup.

parent fb71dd3b
Pipeline #117345789 failed with stage
in 1 minute and 22 seconds
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Samuel Hilson
* @license GPL-2.0-or-later
**/
*/
$specialPageAliases = [];
......
......@@ -7,7 +7,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license MIT
**/
*/
declare(strict_types=1);
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Samuel Hilson
* @license GPL-2.0-or-later
**/
*/
namespace Reverb;
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license MIT
**/
*/
declare(strict_types=1);
......
......@@ -6,14 +6,13 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
namespace Reverb\Api;
use ApiBase;
use CentralIdLookup;
use Hydrawiki\Reverb\Client\V1\Resources\NotificationDismissals as NotificationDismissalsResource;
use MediaWiki\MediaWikiServices;
use Reverb\Identifier\Identifier;
......@@ -147,7 +146,6 @@ class ApiNotifications extends ApiBase {
$success = false;
$lookup = CentralIdLookup::factory();
$serviceUserId = UserIdHelper::getUserIdForService($this->getUser());
$userIdentifier = Identifier::newUser($serviceUserId);
$dismiss = new NotificationDismissalsResource(
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
......
......@@ -6,13 +6,12 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
namespace Reverb\Notification;
use CentralIdLookup;
use DynamicSettings\Wiki;
use Exception;
use Hydrawiki\Reverb\Client\V1\Exceptions\ApiRequestUnsuccessful as ApiRequestUnsuccessful;
......@@ -296,8 +295,7 @@ class Notification {
public function getAgent(): ?User {
$id = $this->getAgentId();
if ($id !== null) {
$lookup = CentralIdLookup::factory();
$user = $lookup->localUserFromCentralId($id->whoAmI());
$user = UserIdHelper::getUserForServiceUserId($id->whoAmI());
if ($user !== null) {
return $user;
}
......@@ -451,7 +449,6 @@ class Notification {
* @return null
*/
public static function dismissNotification(User $user, string $id, int $timestamp): bool {
$lookup = CentralIdLookup::factory();
$serviceUserId = UserIdHelper::getUserIdForService($user);
$userIdentifier = Identifier::newUser($serviceUserId);
if (!$userIdentifier) {
......
......@@ -6,13 +6,12 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
namespace Reverb\Notification;
use CentralIdLookup;
use Hydrawiki\Reverb\Client\V1\Exceptions\ApiRequestUnsuccessful;
use Hydrawiki\Reverb\Client\V1\Resources\NotificationBroadcast as NotificationBroadcastResource;
use MediaWiki\MediaWikiServices;
......@@ -288,8 +287,7 @@ class NotificationBroadcast {
throw new MWException('Invalid agent passed.');
}
$lookup = CentralIdLookup::factory();
$agentGlobalId = $lookup->centralIdFromLocalUser($agent);
$agentGlobalId = UserIdHelper::getUserIdForService($agent);
if (empty($agentGlobalId)) {
return false;
......@@ -317,15 +315,13 @@ class NotificationBroadcast {
* @return void
*/
protected function setTargets(array $targets) {
$lookup = CentralIdLookup::factory();
$targetIdentifiers = [];
foreach ($targets as $key => $target) {
if (!($target instanceof User)) {
throw new MWException('Invalid target passed.');
}
$targetGlobalId = $lookup->centralIdFromLocalUser($target);
$targetGlobalId = UserIdHelper::getUserIdForService($target);
if (!$targetGlobalId) {
unset($targets[$key]);
continue;
......
......@@ -6,14 +6,13 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
namespace Reverb\Notification;
use ArrayObject;
use CentralIdLookup;
use Exception;
use Hydrawiki\Reverb\Client\V1\Exceptions\ApiResponseInvalid;
use MediaWiki\MediaWikiServices;
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
declare(strict_types=1);
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Samuel Hilson
* @license GPL-2.0-or-later
**/
*/
namespace Reverb\Traits;
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license GPL-2.0-or-later
**/
*/
namespace Reverb\Traits;
......
......@@ -6,7 +6,7 @@
* @package Reverb
* @author Alexia E. Smith
* @license MIT
**/
*/
namespace Reverb\Maintenance;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment