diff --git a/app/controllers/exercise_banks_controller.rb b/app/controllers/exercise_banks_controller.rb index 160393e0c..9a35bfcdb 100644 --- a/app/controllers/exercise_banks_controller.rb +++ b/app/controllers/exercise_banks_controller.rb @@ -1,7 +1,7 @@ #encoding: UTF-8 class ExerciseBanksController < ApplicationController before_action :require_login - before_action :find_bank, except: [:choose_shixun] + before_action :find_bank, :bank_visit_auth, except: [:choose_shixun] before_action :bank_admin, only: [:update] before_action :commit_shixun_present, only: [:commit_shixun] diff --git a/app/controllers/gtopic_banks_controller.rb b/app/controllers/gtopic_banks_controller.rb index e0382b21a..f09a8554c 100644 --- a/app/controllers/gtopic_banks_controller.rb +++ b/app/controllers/gtopic_banks_controller.rb @@ -1,6 +1,6 @@ class GtopicBanksController < ApplicationController before_action :require_login - before_action :find_bank + before_action :find_bank, :bank_visit_auth before_action :bank_admin, only: [:edit, :update] def show diff --git a/app/controllers/homework_banks_controller.rb b/app/controllers/homework_banks_controller.rb index 31e733245..61bded033 100644 --- a/app/controllers/homework_banks_controller.rb +++ b/app/controllers/homework_banks_controller.rb @@ -1,6 +1,6 @@ class HomeworkBanksController < ApplicationController before_action :require_login - before_action :find_bank + before_action :find_bank, :bank_visit_auth before_action :bank_params, only: [:update] before_action :bank_admin, only: [:update, :destroy, :set_public] diff --git a/app/controllers/task_banks_controller.rb b/app/controllers/task_banks_controller.rb index 1d3aca955..b88768456 100644 --- a/app/controllers/task_banks_controller.rb +++ b/app/controllers/task_banks_controller.rb @@ -1,6 +1,6 @@ class TaskBanksController < ApplicationController before_action :require_login - before_action :find_bank + before_action :find_bank, :bank_visit_auth before_action :bank_visit_auth before_action :bank_admin, only: [:update] diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index 81093dc12..d43aa5e2d 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -86,7 +86,7 @@ module TidingDecorator def teacher_join_course_content name = Course.find_by(id: container_id)&.name - I18n.t(locale_format extra) % [user.show_real_name, name] + I18n.t(locale_format extra) % [trigger_user&.show_real_name, name] end def apply_add_department_content diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index 33d6e4cda..6083252bc 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -110,23 +110,27 @@ class NewWorkForm extends Component{ {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} // 已有提交作品,人数范围只能扩大 const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state; - if (!min_num) { - this.props.showNotification('最小人数不能为空'); - return; - } else if (min_num < 1) { - this.props.showNotification('最小人数不能小于1'); - return; - } else if (!max_num) { - this.props.showNotification('最大人数不能为空'); - return; - } else if (max_num < min_num) { - this.props.showNotification('最大人数不能小于最小人数'); - return; - } - if (has_commit) { - if (max_num < init_max_num || min_num > init_min_num) { - this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) + const isGroup = this.props.isGroup() + if (isGroup) { + if (!min_num) { + this.props.showNotification('最小人数不能为空'); return; + } else if (min_num < 1) { + this.props.showNotification('最小人数不能小于1'); + return; + } else if (!max_num) { + this.props.showNotification('最大人数不能为空'); + return; + } else if (max_num < min_num) { + this.props.showNotification('最大人数不能小于最小人数'); + return; + } + + if (has_commit) { + if (max_num < init_max_num || min_num > init_min_num) { + this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) + return; + } } }