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