diff --git a/src/Model/Notification.php b/src/Model/Notification.php index 8b0e0f1a51..408f794972 100644 --- a/src/Model/Notification.php +++ b/src/Model/Notification.php @@ -372,7 +372,7 @@ final class Notification */ public function getNetworkList(bool $seen = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT) { - $ident = self::NETWORK; + $ident = self::NETWORK; $notifications = []; $condition = ['wall' => false, 'uid' => local_user()]; @@ -415,7 +415,7 @@ final class Notification */ public function getSystemList(bool $seen = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT) { - $ident = self::SYSTEM; + $ident = self::SYSTEM; $notifications = []; $filter = ['uid' => local_user()]; @@ -460,7 +460,7 @@ final class Notification */ public function getPersonalList(bool $seen = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT) { - $ident = self::PERSONAL; + $ident = self::PERSONAL; $notifications = []; $myurl = str_replace('http://', '', DI::app()->contact['nurl']); @@ -507,7 +507,7 @@ final class Notification */ public function getHomeList(bool $seen = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT) { - $ident = self::HOME; + $ident = self::HOME; $notifications = []; $condition = ['wall' => true, 'uid' => local_user()]; @@ -553,9 +553,9 @@ final class Notification public function getIntroList(bool $all = false, int $start = 0, int $limit = self::DEFAULT_PAGE_LIMIT, int $id = 0) { /// @todo sanitize wording according to SELF::INTRO - $ident = 'introductions'; - $notifications = []; - $sql_extra = ""; + $ident = 'introductions'; + $notifications = []; + $sql_extra = ""; if (empty($id)) { if (!$all) { @@ -623,7 +623,7 @@ final class Notification $intro = [ 'label' => 'friend_suggestion', - 'str_type' => $this->l10n->t('Friend Suggestion'), + 'str_type' => $this->l10n->t('Friend Suggestion'), 'intro_id' => $intro['intro_id'], 'madeby' => $intro['name'], 'madeby_url' => $intro['url'], @@ -657,7 +657,7 @@ final class Notification } $intro = [ 'label' => (($intro['network'] !== Protocol::OSTATUS) ? 'friend_request' : 'follower'), - 'str_type' => (($intro['network'] !== Protocol::OSTATUS) ? $this->l10n->t('Friend/Connect Request') : $this->l10n->t('New Follower')), + 'str_type' => (($intro['network'] !== Protocol::OSTATUS) ? $this->l10n->t('Friend/Connect Request') : $this->l10n->t('New Follower')), 'dfrn_id' => $intro['issued-id'], 'uid' => $_SESSION['uid'], 'intro_id' => $intro['intro_id'], diff --git a/src/Module/BaseNotifications.php b/src/Module/BaseNotifications.php index a0c49a0646..728a9d402d 100644 --- a/src/Module/BaseNotifications.php +++ b/src/Module/BaseNotifications.php @@ -110,16 +110,16 @@ abstract class BaseNotifications extends BaseModule /** * Shows the printable result of notifications for a specific tab * - * @param string $header The notification header - * @param array $content The array with the notifications - * @param string $noContent The string in case there are no notifications - * @param array $showLink The possible links at the top + * @param string $header The notification header + * @param array $notifications The array with the notifications + * @param string $noContent The string in case there are no notifications + * @param array $showLink The possible links at the top * * @return string The rendered output * * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - protected static function printContent(string $header, array $content, string $noContent, array $showLink) + protected static function printContent(string $header, array $notifications, string $noContent, array $showLink) { // Get the nav tabs for the notification pages $tabs = self::getTabs(); @@ -129,12 +129,12 @@ abstract class BaseNotifications extends BaseModule $notif_tpl = Renderer::getMarkupTemplate('notifications/notifications.tpl'); return Renderer::replaceMacros($notif_tpl, [ - '$notif_header' => $header ?? DI::l10n()->t('Notifications'), - '$tabs' => $tabs, - '$notif_content' => $content, - '$notif_nocontent' => $noContent, - '$notif_show_lnk' => $showLink, - '$notif_paginate' => $pager->renderMinimal(count($content)) + '$header' => $header ?? DI::l10n()->t('Notifications'), + '$tabs' => $tabs, + '$notifications' => $notifications, + '$noContent' => $noContent, + '$showLink' => $showLink, + '$paginate' => $pager->renderMinimal(count($notifications)) ]); } diff --git a/src/Module/Notifications/Introductions.php b/src/Module/Notifications/Introductions.php index dc62110e2b..99066bd3c9 100644 --- a/src/Module/Notifications/Introductions.php +++ b/src/Module/Notifications/Introductions.php @@ -62,29 +62,29 @@ class Introductions extends BaseNotifications switch ($notification['label']) { case 'friend_suggestion': $notificationContent[] = Renderer::replaceMacros($notificationSuggestions, [ - '$type' => $notification['label'], + '$type' => $notification['label'], 'str_notification_type' => DI::l10n()->t('Notification type:'), - 'str_type' => $notification['str_type'], - '$intro_id' => $notification['intro_id'], - '$lbl_madeby' => DI::l10n()->t('Suggested by:'), - '$madeby' => $notification['madeby'], - '$madeby_url' => $notification['madeby_url'], - '$madeby_zrl' => $notification['madeby_zrl'], - '$madeby_addr' => $notification['madeby_addr'], - '$contact_id' => $notification['contact_id'], - '$photo' => $notification['photo'], - '$fullname' => $notification['name'], - '$url' => $notification['url'], - '$zrl' => $notification['zrl'], - '$lbl_url' => DI::l10n()->t('Profile URL'), - '$addr' => $notification['addr'], - '$hidden' => ['hidden', DI::l10n()->t('Hide this contact from others'), ($notification['hidden'] == 1), ''], - '$knowyou' => $notification['knowyou'], - '$approve' => DI::l10n()->t('Approve'), - '$note' => $notification['note'], - '$request' => $notification['request'], - '$ignore' => DI::l10n()->t('Ignore'), - '$discard' => DI::l10n()->t('Discard'), + 'str_type' => $notification['str_type'], + '$intro_id' => $notification['intro_id'], + '$lbl_madeby' => DI::l10n()->t('Suggested by:'), + '$madeby' => $notification['madeby'], + '$madeby_url' => $notification['madeby_url'], + '$madeby_zrl' => $notification['madeby_zrl'], + '$madeby_addr' => $notification['madeby_addr'], + '$contact_id' => $notification['contact_id'], + '$photo' => $notification['photo'], + '$fullname' => $notification['name'], + '$url' => $notification['url'], + '$zrl' => $notification['zrl'], + '$lbl_url' => DI::l10n()->t('Profile URL'), + '$addr' => $notification['addr'], + '$hidden' => ['hidden', DI::l10n()->t('Hide this contact from others'), ($notification['hidden'] == 1), ''], + '$knowyou' => $notification['knowyou'], + '$approve' => DI::l10n()->t('Approve'), + '$note' => $notification['note'], + '$request' => $notification['request'], + '$ignore' => DI::l10n()->t('Ignore'), + '$discard' => DI::l10n()->t('Discard'), ]); break; @@ -146,39 +146,39 @@ class Introductions extends BaseNotifications } $notificationContent[] = Renderer::replaceMacros($notificationTemplate, [ - '$type' => $notification['label'], - '$header' => $header, + '$type' => $notification['label'], + '$header' => $header, 'str_notification_type' => DI::l10n()->t('Notification type:'), - 'str_type' => $notification['notifytype'], - '$dfrn_text' => $dfrn_text, - '$dfrn_id' => $notification['dfrn_id'], - '$uid' => $notification['uid'], - '$intro_id' => $notification['intro_id'], - '$contact_id' => $notification['contact_id'], - '$photo' => $notification['photo'], - '$fullname' => $notification['name'], - '$location' => $notification['location'], - '$lbl_location' => DI::l10n()->t('Location:'), - '$about' => $notification['about'], - '$lbl_about' => DI::l10n()->t('About:'), - '$keywords' => $notification['keywords'], - '$lbl_keywords' => DI::l10n()->t('Tags:'), - '$gender' => $notification['gender'], - '$lbl_gender' => DI::l10n()->t('Gender:'), - '$hidden' => ['hidden', DI::l10n()->t('Hide this contact from others'), ($notification['hidden'] == 1), ''], - '$url' => $notification['url'], - '$zrl' => $notification['zrl'], - '$lbl_url' => DI::l10n()->t('Profile URL'), - '$addr' => $notification['addr'], - '$lbl_knowyou' => $lbl_knowyou, - '$lbl_network' => DI::l10n()->t('Network:'), - '$network' => ContactSelector::networkToName($notification['network'], $notification['url']), - '$knowyou' => $knowyou, - '$approve' => DI::l10n()->t('Approve'), - '$note' => $notification['note'], - '$ignore' => DI::l10n()->t('Ignore'), - '$discard' => $discard, - '$action' => $action, + 'str_type' => $notification['notifytype'], + '$dfrn_text' => $dfrn_text, + '$dfrn_id' => $notification['dfrn_id'], + '$uid' => $notification['uid'], + '$intro_id' => $notification['intro_id'], + '$contact_id' => $notification['contact_id'], + '$photo' => $notification['photo'], + '$fullname' => $notification['name'], + '$location' => $notification['location'], + '$lbl_location' => DI::l10n()->t('Location:'), + '$about' => $notification['about'], + '$lbl_about' => DI::l10n()->t('About:'), + '$keywords' => $notification['keywords'], + '$lbl_keywords' => DI::l10n()->t('Tags:'), + '$gender' => $notification['gender'], + '$lbl_gender' => DI::l10n()->t('Gender:'), + '$hidden' => ['hidden', DI::l10n()->t('Hide this contact from others'), ($notification['hidden'] == 1), ''], + '$url' => $notification['url'], + '$zrl' => $notification['zrl'], + '$lbl_url' => DI::l10n()->t('Profile URL'), + '$addr' => $notification['addr'], + '$lbl_knowyou' => $lbl_knowyou, + '$lbl_network' => DI::l10n()->t('Network:'), + '$network' => ContactSelector::networkToName($notification['network'], $notification['url']), + '$knowyou' => $knowyou, + '$approve' => DI::l10n()->t('Approve'), + '$note' => $notification['note'], + '$ignore' => DI::l10n()->t('Ignore'), + '$discard' => $discard, + '$action' => $action, ]); break; } diff --git a/src/Module/Notifications/Notifications.php b/src/Module/Notifications/Notifications.php index 432ae93aea..3dffe90b5b 100644 --- a/src/Module/Notifications/Notifications.php +++ b/src/Module/Notifications/Notifications.php @@ -80,15 +80,15 @@ class Notifications extends BaseNotifications // notification and apply the correct template according to the notificationtype (label). 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', + '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', ]; $notificationTemplate = Renderer::getMarkupTemplate($notification_templates[$notification['label']]); diff --git a/view/global.css b/view/global.css index 0eaf4482dc..b82ad6e030 100644 --- a/view/global.css +++ b/view/global.css @@ -274,7 +274,7 @@ code, key { } /* notifications unseen */ -.notify-unseen { background-color: #cceeFF; } +.notification-unseen { background-color: #cceeFF; } /* autocomplete popup */ ul.acpopup { diff --git a/view/js/main.js b/view/js/main.js index c12156e4f8..b702669003 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -299,19 +299,19 @@ $(function() { var notification_id = 0; // Insert notifs into the notifications-menu - $(data.notifications).each(function(key, notif) { - var text = notif.message.format('' + notif.name + ''); - var contact = ('' + notif.name + ''); - var seenclass = (notif.seen == 1) ? "notify-seen" : "notify-unseen"; + $(data.notifications).each(function(key, notification) { + var text = notification.message.format('' + notification.name + ''); + var contact = ('' + notification.name + ''); + var seenclass = (notification.seen == 1) ? "notification-seen" : "notification-unseen"; var html = notifications_tpl.format( - notif.href, // {0} // link to the source - notif.photo, // {1} // photo of the contact + notification.href, // {0} // link to the source + notification.photo, // {1} // photo of the contact text, // {2} // preformatted text (autor + text) - notif.date, // {3} // date of notification (time ago) + notification.date, // {3} // date of notification (time ago) seenclass, // {4} // visited status of the notification - new Date(notif.timestamp*1000), // {5} // date of notification - notif.url, // {6} // profile url of the contact - notif.message.format(contact), // {7} // preformatted html (text including author profile url) + new Date(notification.timestamp*1000), // {5} // date of notification + notification.url, // {6} // profile url of the contact + notification.message.format(contact), // {7} // preformatted html (text including author profile url) '' // {8} // Deprecated ); nnm.append(html); diff --git a/view/templates/nav.tpl b/view/templates/nav.tpl index b9c2cf1f12..f39e58705b 100644 --- a/view/templates/nav.tpl +++ b/view/templates/nav.tpl @@ -34,7 +34,7 @@ {{$nav.community.1}} {{/if}} {{if $nav.introductions}} - {{$nav.introductions.1}} + {{$nav.introductions.1}} {{/if}} {{if $nav.messages}} @@ -49,7 +49,7 @@ {{if $nav.notifications}} {{$nav.notifications.1}} - +