]> git.mxchange.org Git - friendica.git/commitdiff
Remove parameter-less call of OStatus\Salmon module in DFRN\Notify
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 8 Dec 2022 14:45:33 +0000 (09:45 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 10 Dec 2022 16:45:53 +0000 (11:45 -0500)
- Address https://github.com/friendica/friendica/issues/11993#issuecomment-1342615279

src/Module/DFRN/Notify.php
src/Module/OStatus/Salmon.php

index 34cf21f11df66b8d03d9d0f832d350dd45360da5..14b121e81079fce24b9e2c6673aecacb013fa222 100644 (file)
@@ -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);
                }
        }
 
index 0d393afcce99f4bd69fa5ce12e9b9f8229ab495c..f928e308d528f90a1ff4df48022aa5814938d054 100644 (file)
@@ -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)) {