diff --git a/api/courses.go b/api/courses.go index fde4b654d..2ed826568 100644 --- a/api/courses.go +++ b/api/courses.go @@ -286,17 +286,12 @@ func (r coursesRoutes) getPinned(c *gin.Context) { user := tumLiveContext.User resp := make([]model.CourseDTO, 0, len(pinnedCourses)) for _, course := range pinnedCourses { - enrolled := false - if user != nil { - var err error - // todo: check if user is allowed to see the course - // -> Get full course from database - enrolled, err = r.CoursesDao.IsUserEnrolledInCourse(tumLiveContext.User.ID, course.ID) - if err != nil { - enrolled = false - } + // todo: check if user is allowed to see the course + // -> Get full course from database + enrolled, err := r.CoursesDao.IsUserEnrolledInCourse(tumLiveContext.User.ID, course.ID) + if err != nil { + enrolled = false } - if course.Visibility == "enrolled" && !enrolled { continue }