From c0e4d5bf39fcb8e17a3ca23ecf592bdcf4c61e65 Mon Sep 17 00:00:00 2001 From: srosse <stephane.rosse@frentix.com> Date: Tue, 13 Oct 2020 13:57:38 +0200 Subject: [PATCH] OO-4973: use the non-blocking method to know if lectures are enabled --- .../olat/course/run/CourseRuntimeController.java | 4 +--- .../modules/coach/ui/UserDetailsController.java | 14 +++----------- .../org/olat/modules/lecture/LectureService.java | 7 +++---- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/olat/course/run/CourseRuntimeController.java b/src/main/java/org/olat/course/run/CourseRuntimeController.java index d5ab223059d..4cf8543bacb 100644 --- a/src/main/java/org/olat/course/run/CourseRuntimeController.java +++ b/src/main/java/org/olat/course/run/CourseRuntimeController.java @@ -139,7 +139,6 @@ import org.olat.instantMessaging.OpenInstantMessageEvent; import org.olat.modules.assessment.ui.AssessmentToolSecurityCallback; import org.olat.modules.lecture.LectureModule; import org.olat.modules.lecture.LectureService; -import org.olat.modules.lecture.RepositoryEntryLectureConfiguration; import org.olat.modules.lecture.ui.LectureRepositoryAdminController; import org.olat.modules.lecture.ui.LecturesSecurityCallback; import org.olat.modules.lecture.ui.LecturesSecurityCallbackFactory; @@ -624,8 +623,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im } private boolean isLectureEnabled() { - RepositoryEntryLectureConfiguration lectureConfig = lectureService.getRepositoryEntryLectureConfiguration(getRepositoryEntry()); - return lectureConfig != null && lectureConfig.isLectureEnabled(); + return lectureService.isRepositoryEntryLectureEnabled(getRepositoryEntry()); } private void initToolsMenuStatistics(Dropdown tools, ICourse course, final UserCourseEnvironmentImpl uce) { diff --git a/src/main/java/org/olat/modules/coach/ui/UserDetailsController.java b/src/main/java/org/olat/modules/coach/ui/UserDetailsController.java index 7035db4e9cc..6731ce8f194 100644 --- a/src/main/java/org/olat/modules/coach/ui/UserDetailsController.java +++ b/src/main/java/org/olat/modules/coach/ui/UserDetailsController.java @@ -53,9 +53,7 @@ import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironmentImpl; import org.olat.modules.assessment.ui.event.AssessmentFormEvent; import org.olat.modules.coach.model.EfficiencyStatementEntry; -import org.olat.modules.lecture.LectureModule; import org.olat.modules.lecture.LectureService; -import org.olat.modules.lecture.RepositoryEntryLectureConfiguration; import org.olat.modules.lecture.ui.ParticipantLectureBlocksController; import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntrySecurity; @@ -91,9 +89,6 @@ public class UserDetailsController extends BasicController implements Activateab private final Identity assessedIdentity; - - @Autowired - private LectureModule lectureModule; @Autowired private LectureService lectureService; @Autowired @@ -134,12 +129,9 @@ public class UserDetailsController extends BasicController implements Activateab assessmentLink = LinkFactory.createLink("details.assessment", mainVC, this); segmentView.addSegment(assessmentLink, selectSegment == Segment.assessment); - if(lectureModule.isEnabled()) { - RepositoryEntryLectureConfiguration lectureConfig = lectureService.getRepositoryEntryLectureConfiguration(entry); - if(lectureConfig != null && lectureConfig.isLectureEnabled()) { - lecturesLink = LinkFactory.createLink("details.lectures", mainVC, this); - segmentView.addSegment(lecturesLink, selectSegment == Segment.lectures); - } + if(lectureService.isRepositoryEntryLectureEnabled(entry)) { + lecturesLink = LinkFactory.createLink("details.lectures", mainVC, this); + segmentView.addSegment(lecturesLink, selectSegment == Segment.lectures); } if(selectSegment == Segment.assessment) { diff --git a/src/main/java/org/olat/modules/lecture/LectureService.java b/src/main/java/org/olat/modules/lecture/LectureService.java index 7da377a6123..4210b8ca101 100644 --- a/src/main/java/org/olat/modules/lecture/LectureService.java +++ b/src/main/java/org/olat/modules/lecture/LectureService.java @@ -62,7 +62,7 @@ public interface LectureService { /** - * Get (or create) the configuration object for the specified repossitory + * Get (or create) the configuration object for the specified repository * entry. * * @param entry @@ -72,9 +72,8 @@ public interface LectureService { /** * - * - * @param entry - * @return + * @param entry The course + * @return true if the module is enabled and the course has the lectures enabled */ public boolean isRepositoryEntryLectureEnabled(RepositoryEntryRef entry); -- GitLab