From daad1f1a54ddfb1ace687af2577ceaf30e61e49d Mon Sep 17 00:00:00 2001 From: bivanalhar Date: Thu, 2 May 2024 11:46:37 +0800 Subject: [PATCH] fix(duplication): remove source courses list --- .../course/object_duplications_controller.rb | 13 ------------- .../course/object_duplications/new.json.jbuilder | 5 ----- client/app/api/course/Duplication.js | 2 -- 3 files changed, 20 deletions(-) diff --git a/app/controllers/course/object_duplications_controller.rb b/app/controllers/course/object_duplications_controller.rb index 2bc3a382a80..44013bba1c7 100644 --- a/app/controllers/course/object_duplications_controller.rb +++ b/app/controllers/course/object_duplications_controller.rb @@ -4,7 +4,6 @@ class Course::ObjectDuplicationsController < Course::ComponentController helper Course::Achievement::AchievementsHelper def new - load_source_courses_data load_destination_courses_data load_items_data load_destination_instances_data @@ -25,18 +24,6 @@ def authorize_duplication private - def load_source_courses_data - ActsAsTenant.without_tenant do - # Workaround to get Courses where current user is allowed to duplicate contents from - # without having to use accessible_by, which can take up to 5 minutes with includes - course_copiers = CourseUser.where(user: current_user). - where(role: CourseUser::MANAGER_ROLES.to_a) + - CourseUser.where(user: current_user). - where(role: :observer) - @source_courses = Course.includes(:instance).find(course_copiers.map(&:course_id)) - end - end - def load_destination_courses_data ActsAsTenant.without_tenant do # Workaround to get Courses where current user plays one of manager roles diff --git a/app/views/course/object_duplications/new.json.jbuilder b/app/views/course/object_duplications/new.json.jbuilder index 88bcb39721f..070191e3552 100644 --- a/app/views/course/object_duplications/new.json.jbuilder +++ b/app/views/course/object_duplications/new.json.jbuilder @@ -1,11 +1,6 @@ # frozen_string_literal: true json.currentHost current_tenant.host -json.sourceCourses @source_courses do |course| - json.(course, :id, :title) - json.host course.instance.host -end - json.destinationCourses @destination_courses do |course| json.(course, :id, :title) json.path course_path(course) diff --git a/client/app/api/course/Duplication.js b/client/app/api/course/Duplication.js index 8f7330afa9b..bbecbb52ecf 100644 --- a/client/app/api/course/Duplication.js +++ b/client/app/api/course/Duplication.js @@ -9,8 +9,6 @@ export default class DuplicationAPI extends BaseCourseAPI { * currentHost: string, * destinationCourses: Array., * destinationInstances: Array., - * sourceCourses: courseListingShape, - * sourceCourse: sourceCourseShape, * assessmentComponent: Array., * surveyComponent: Array., * achievementsComponent: Array.,