<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
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;
$birthday_count = 0;
$today_birthday_count = 0;
-
- if ($this->session->getLocalUserId()) {
+ // Suppress notification display for forum accounts
+ if ($this->session->getLocalUserId() && $this->session->get('page_flags', '') != User::PAGE_FLAGS_COMMUNITY) {
if ($this->pconfig->get($this->session->getLocalUserId(), 'system', 'detailed_notif')) {
$notifications = $this->notificationRepo->selectDetailedForUser($this->session->getLocalUserId());
} else {
// 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')) {
- foreach ($registrations as $reg) {
+ foreach ($registrations as $registration) {
$navNotifications[] = $this->formattedNavNotification->createFromParams(
- [
- 'name' => $reg['name'],
- 'url' => $reg['url'],
- ],
+ $registration['name'],
+ $registration['url'],
$this->l10n->t('{0} requested registration'),
- new \DateTime($reg['created'], new \DateTimeZone('UTC')),
- new Uri($this->baseUrl->get(true) . '/admin/users/pending')
+ new \DateTime($registration['created'], new \DateTimeZone('UTC')),
+ new Uri($this->baseUrl . '/moderation/users/pending')
);
}
- } elseif (count($registrations) > 1) {
+ } else {
$navNotifications[] = $this->formattedNavNotification->createFromParams(
- [
- 'name' => $registrations[0]['name'],
- 'url' => $registrations[0]['url'],
- ],
+ $registrations[0]['name'],
+ $registrations[0]['url'],
$this->l10n->t('{0} and %d others requested registration', count($registrations) - 1),
new \DateTime($registrations[0]['created'], new \DateTimeZone('UTC')),
- new Uri($this->baseUrl->get(true) . '/admin/users/pending')
+ new Uri($this->baseUrl . '/moderation/users/pending')
);
}