use Friendica\DI;
use Friendica\Model\Group;
use Friendica\Model\Post;
+use Friendica\Model\User;
use Friendica\Model\Verb;
use Friendica\Module\Register;
use Friendica\Module\Response;
if (local_user()) {
if (DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
- $notifications = $this->notificationRepo->selectForUser(local_user(), ['`vid` != ?', Verb::getID(\Friendica\Protocol\Activity::LIKE)], ['limit' => 50]);
+ $notifications = $this->notificationRepo->selectDetailedForUser(local_user());
} else {
$notifications = $this->notificationRepo->selectDigestForUser(local_user());
}
}
}
- // Temporary workaround for notifications without messages like with the following verb:
- // - \Friendica\Protocol\Activity::ANNOUNCE
- $navNotifications = array_map(function (Entity\Notification $notification) {
+ $owner = User::getOwnerDataById(local_user());
+
+ $navNotifications = array_map(function (Entity\Notification $notification) use ($owner) {
+ if (!DI::notify()->NotifyOnDesktop($notification)) {
+ return null;
+ }
+ if (($notification->type == Post\UserNotification::TYPE_NONE) && in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP])) {
+ return null;
+ }
try {
return $this->formattedNavNotification->createFromNotification($notification);
} catch (NoMessageException $e) {
if (isset($_GET['callback'])) {
// JSONP support
- header("Content-type: application/javascript");
- echo $_GET['callback'] . '(' . json_encode(['result' => $data]) . ')';
- exit;
+ System::httpExit($_GET['callback'] . '(' . json_encode(['result' => $data]) . ')', Response::TYPE_BLANK, 'application/javascript');
} else {
System::jsonExit(['result' => $data]);
}