Merge pull request #12364 from MrPetovan/bug/warnings

Address several warning messages
This commit is contained in:
Michael Vogel 2022-12-10 18:10:24 +01:00 committed by GitHub
commit 46660c9462
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 35 deletions

View 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);
}
}

View file

@ -48,6 +48,7 @@ use Friendica\Navigation\Notifications\Factory;
use Friendica\Navigation\Notifications\Repository;
use Friendica\Navigation\Notifications\ValueObject;
use Friendica\Navigation\SystemMessages;
use Friendica\Network\HTTPException;
use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Profiler;
@ -229,7 +230,11 @@ class Ping extends BaseModule
// merge all notification types in one array
foreach ($intros as $intro) {
$navNotifications[] = $this->formattedNavNotification->createFromIntro($intro);
try {
$navNotifications[] = $this->formattedNavNotification->createFromIntro($intro);
} catch (HTTPException\NotFoundException $e) {
$this->introductionRepo->delete($intro);
}
}
if (count($registrations) <= 1 || $this->pconfig->get($this->session->getLocalUserId(), 'system', 'detailed_notif')) {
@ -242,7 +247,7 @@ class Ping extends BaseModule
new Uri($this->baseUrl->get(true) . '/moderation/users/pending')
);
}
} elseif (count($registrations) > 1) {
} else {
$navNotifications[] = $this->formattedNavNotification->createFromParams(
$registrations[0]['name'],
$registrations[0]['url'],

View 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)) {