aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/course/forum/topics.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/course/forum/topics.php')
-rw-r--r--app/controllers/course/forum/topics.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/app/controllers/course/forum/topics.php b/app/controllers/course/forum/topics.php
index b6a1307..ca22f89 100644
--- a/app/controllers/course/forum/topics.php
+++ b/app/controllers/course/forum/topics.php
@@ -1,5 +1,4 @@
<?php
-require_once 'BaseController.php';
use Forum\Category;
use Forum\Subscription;
@@ -33,14 +32,17 @@ class Course_Forum_TopicsController extends Forum\BaseController
PageLayout::setTitle($topic->name);
- $user_subscription = Subscription::findOneBySQL(
- "subject = :subject AND subject_id = :subject_id AND user_id = :user_id",
- [
- 'subject' => 'topic',
- 'subject_id' => $topic->getId(),
- 'user_id' => User::findCurrent()->user_id
- ]
- );
+ $user_subscription = null;
+ if ($this->user_id) {
+ $user_subscription = Subscription::findOneBySQL(
+ "subject = :subject AND subject_id = :subject_id AND user_id = :user_id",
+ [
+ 'subject' => 'topic',
+ 'subject_id' => $topic->getId(),
+ 'user_id' => $this->user_id
+ ]
+ );
+ }
$this->render_vue_app(
Studip\VueApp::create('forum/topics/Show')