From: Hypolite Petovan Date: Thu, 8 Dec 2022 14:45:33 +0000 (-0500) Subject: Remove parameter-less call of OStatus\Salmon module in DFRN\Notify X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=71a7f2d5034211a3e640c24663e0bad7a24c466a;p=friendica.git Remove parameter-less call of OStatus\Salmon module in DFRN\Notify - Address https://github.com/friendica/friendica/issues/11993#issuecomment-1342615279 --- diff --git a/src/Module/DFRN/Notify.php b/src/Module/DFRN/Notify.php index 34cf21f11d..14b121e810 100644 --- a/src/Module/DFRN/Notify.php +++ b/src/Module/DFRN/Notify.php @@ -70,18 +70,8 @@ class Notify extends BaseModule throw new \Friendica\Network\HTTPException\InternalServerErrorException(); } $this->dispatchPrivate($user, $postdata); - } elseif (!$this->dispatchPublic($postdata)) { - (new Salmon( - $this->database, - $this->l10n, - $this->baseUrl, - $this->args, - $this->logger, - $this->profiler, - $this->response, - $this->server, - $this->parameters - ))->rawContent($request); + } else { + $this->dispatchPublic($postdata); } } diff --git a/src/Module/OStatus/Salmon.php b/src/Module/OStatus/Salmon.php index 0d393afcce..f928e308d5 100644 --- a/src/Module/OStatus/Salmon.php +++ b/src/Module/OStatus/Salmon.php @@ -66,11 +66,12 @@ class Salmon extends \Friendica\BaseModule { $xml = Network::postdata(); - $this->logger->debug('New Salmon', ['nickname' => $this->parameters['nickname'], 'xml' => $xml]); - - // Despite having a route with a mandatory nickname parameter, this method can also be called from - // \Friendica\Module\DFRN\Notify->post where the same parameter is optional 🤷‍ $nickname = $this->parameters['nickname'] ?? ''; + if (empty($nickname)) { + throw new HTTPException\BadRequestException('nickname parameter is mandatory'); + } + + $this->logger->debug('New Salmon', ['nickname' => $nickname, 'xml' => $xml]); $importer = $this->database->selectFirst('user', [], ['nickname' => $nickname, 'account_expired' => false, 'account_removed' => false]); if (!$this->database->isResult($importer)) {