课程allow_join方法增加课程的传入,减少课程获取次数
This commit is contained in:
parent
22a5d6a6b0
commit
6530c657ee
|
@ -29,7 +29,7 @@ class CoursesController < ApplicationController
|
|||
if course
|
||||
@state = 4
|
||||
else
|
||||
unless (allow_join && User.current.member_of_course?(course))
|
||||
unless (allow_join(course) && User.current.member_of_course?(course))
|
||||
if params[:course_password] == course.password
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => User.current.id)
|
||||
|
@ -700,8 +700,8 @@ class CoursesController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
def allow_join
|
||||
if course_endTime_timeout? Course.find(params[:object_id])
|
||||
def allow_join course
|
||||
if course_endTime_timeout? course
|
||||
respond_to do |format|
|
||||
format.js {
|
||||
@state = 2
|
||||
|
|
Loading…
Reference in New Issue