Skip to content
Snippets Groups Projects
Commit a9e3db38 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

store visit if user opened comments, fixes #903

Closes #903
parent c3f5924f
No related branches found
No related tags found
No related merge requests found
...@@ -90,6 +90,11 @@ class NewsController extends StudipController ...@@ -90,6 +90,11 @@ class NewsController extends StudipController
return $this->render_nothing(); 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 // Check if user wrote a comment
if (Request::submitted('accept') && trim(Request::get('comment_content')) && Request::isPost()) { if (Request::submitted('accept') && trim(Request::get('comment_content')) && Request::isPost()) {
CSRFProtection::verifySecurityToken(); CSRFProtection::verifySecurityToken();
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<? <?
if ($new['allow_comments']) : if ($new['allow_comments']) :
$num = StudipComment::NumCommentsForObject($new['news_id']); $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); $isnew = StudipComment::NumCommentsForObjectSinceLastVisit($new['news_id'], $visited, $GLOBALS['user']->id);
?> ?>
<? if ($num): ?> <? if ($num): ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment