mirror of
https://github.com/friendica/friendica
synced 2025-04-25 06:30:11 +00:00
Move notification to the new paradigm
This commit is contained in:
parent
bc0734e0f1
commit
7a2d5f6a8e
16 changed files with 175 additions and 420 deletions
|
@ -78,7 +78,7 @@ class Notification extends BaseModule
|
|||
|
||||
if (DI::args()->get(1) === 'mark' && DI::args()->get(2) === 'all') {
|
||||
try {
|
||||
DI::dba()->update('notification', ['seen' => true], ['uid' => local_user()]);
|
||||
DI::notification()->setAllSeenForUser(local_user());
|
||||
$success = DI::notify()->setAllSeenForUser(local_user());
|
||||
} catch (\Exception $e) {
|
||||
DI::logger()->warning('set all seen failed.', ['exception' => $e]);
|
||||
|
@ -118,7 +118,7 @@ class Notification extends BaseModule
|
|||
DI::notify()->save($Notify);
|
||||
} else {
|
||||
if ($Notify->uriId) {
|
||||
DI::dba()->update('notification', ['seen' => true], ['uid' => $Notify->uid, 'target-uri-id' => $Notify->uriId]);
|
||||
DI::notification()->setAllSeenForUser($Notify->uid, ['target-uri-id' => $Notify->uriId]);
|
||||
}
|
||||
|
||||
DI::notify()->setAllSeenForRelatedNotify($Notify);
|
||||
|
|
|
@ -95,25 +95,24 @@ class Notifications extends BaseNotifications
|
|||
$notificationHeader = $notificationResult['header'] ?? '';
|
||||
|
||||
if (!empty($notifications['notifications'])) {
|
||||
$notificationTemplates = [
|
||||
'like' => 'notifications/likes_item.tpl',
|
||||
'dislike' => 'notifications/dislikes_item.tpl',
|
||||
'attend' => 'notifications/attend_item.tpl',
|
||||
'attendno' => 'notifications/attend_item.tpl',
|
||||
'attendmaybe' => 'notifications/attend_item.tpl',
|
||||
'friend' => 'notifications/friends_item.tpl',
|
||||
'comment' => 'notifications/comments_item.tpl',
|
||||
'post' => 'notifications/posts_item.tpl',
|
||||
'notification' => 'notifications/notification.tpl',
|
||||
];
|
||||
// Loop trough ever notification This creates an array with the output html for each
|
||||
// notification and apply the correct template according to the notificationtype (label).
|
||||
/** @var FormattedNotification $notification */
|
||||
foreach ($notifications['notifications'] as $notification) {
|
||||
$notification_templates = [
|
||||
'like' => 'notifications/likes_item.tpl',
|
||||
'dislike' => 'notifications/dislikes_item.tpl',
|
||||
'attend' => 'notifications/attend_item.tpl',
|
||||
'attendno' => 'notifications/attend_item.tpl',
|
||||
'attendmaybe' => 'notifications/attend_item.tpl',
|
||||
'friend' => 'notifications/friends_item.tpl',
|
||||
'comment' => 'notifications/comments_item.tpl',
|
||||
'post' => 'notifications/posts_item.tpl',
|
||||
'notification' => 'notifications/notification.tpl',
|
||||
];
|
||||
/** @var FormattedNotification $Notification */
|
||||
foreach ($notifications['notifications'] as $Notification) {
|
||||
$notificationArray = $Notification->toArray();
|
||||
|
||||
$notificationArray = $notification->toArray();
|
||||
|
||||
$notificationTemplate = Renderer::getMarkupTemplate($notification_templates[$notificationArray['label']]);
|
||||
$notificationTemplate = Renderer::getMarkupTemplate($notificationTemplates[$notificationArray['label']]);
|
||||
|
||||
$notificationContent[] = Renderer::replaceMacros($notificationTemplate, [
|
||||
'$notification' => $notificationArray
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue