Merge pull request #2921 from rabuzarus/1611_fix_NotificationsManager_unseen

Bugfix: seen status was not handled correcty on the notifications page
This commit is contained in:
Michael Vogel 2016-11-16 07:02:06 +01:00 committed by GitHub
commit a63e060b51

View file

@ -213,8 +213,9 @@ class NotificationsManager {
// Because we use different db tables for the notification query
// we have sometimes $it['unseen'] and sometimes $it['seen].
// So we will have to transform $it['unseen']
if($it['unseen'])
if (array_key_exists('unseen', $it)) {
$it['seen'] = ($it['unseen'] > 0 ? false : true);
}
// Depending on the identifier of the notification we need to use different defaults
switch ($ident) {
@ -224,7 +225,6 @@ class NotificationsManager {
$default_item_image = proxy_url($it['photo'], false, PROXY_SIZE_MICRO);
$default_item_text = strip_tags(bbcode($it['msg']));
$default_item_when = relative_date($it['date']);
$default_tpl = $tpl_notify;
break;
case 'home':
@ -233,7 +233,6 @@ class NotificationsManager {
$default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO);
$default_item_text = sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname']);
$default_item_when = relative_date($it['created']);
$default_tpl = $tpl_item_comments;
break;
default:
@ -244,7 +243,6 @@ class NotificationsManager {
? sprintf(t("%s created a new post"), $it['author-name'])
: sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname']));
$default_item_when = relative_date($it['created']);
$default_tpl = (($it['id'] == $it['parent']) ? $tpl_item_posts : $tpl_item_comments);
}