Bugfix: seen status was not handled correcty on the notifications page

This commit is contained in:
rabuzarus 2016-11-16 04:57:55 +01:00
parent 7729e6cfb4
commit e4a625ad12

View file

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