diff --git a/app/controllers/news.php b/app/controllers/news.php index 81e832edb243ed0c3d69affac57e8db5f5a3de60..6ce922e2e4c3f112185a0cf35e172ce23eee55c1 100644 --- a/app/controllers/news.php +++ b/app/controllers/news.php @@ -90,6 +90,11 @@ class NewsController extends StudipController return $this->render_nothing(); } + // Store visit if user opened comments + if (Request::bool('comments') && Request::submitted('contentbox_open')) { + object_set_visit(Request::option('contentbox_open'), 'news'); + } + // Check if user wrote a comment if (Request::submitted('accept') && trim(Request::get('comment_content')) && Request::isPost()) { CSRFProtection::verifySecurityToken(); diff --git a/app/views/news/_actions.php b/app/views/news/_actions.php index b3df43c14c9b714b46a677bfe4d835e6c71b2ae9..15daf3c15fd73671b0de123da37c4ac67a5dbfe5 100644 --- a/app/views/news/_actions.php +++ b/app/views/news/_actions.php @@ -18,7 +18,7 @@ <? if ($new['allow_comments']) : $num = StudipComment::NumCommentsForObject($new['news_id']); - $visited = object_get_visit($new['news_id'], 'news', false, false); + $visited = object_get_visit($new['news_id'], 'news'); $isnew = StudipComment::NumCommentsForObjectSinceLastVisit($new['news_id'], $visited, $GLOBALS['user']->id); ?> <? if ($num): ?>