修复当课程ID不存在时加入课程按钮报404而不会给出提示的BUG
This commit is contained in:
parent
90d4140a25
commit
22a5d6a6b0
|
@ -21,7 +21,7 @@ class CoursesController < ApplicationController
|
||||||
before_filter :toggleCourse, only: [:finishcourse, :restartcourse]
|
before_filter :toggleCourse, only: [:finishcourse, :restartcourse]
|
||||||
|
|
||||||
before_filter :require_login, :only => [:join, :unjoin]
|
before_filter :require_login, :only => [:join, :unjoin]
|
||||||
before_filter :allow_join, :only => [:join]
|
#before_filter :allow_join, :only => [:join]
|
||||||
|
|
||||||
def join
|
def join
|
||||||
if User.current.logged?
|
if User.current.logged?
|
||||||
|
@ -29,7 +29,7 @@ class CoursesController < ApplicationController
|
||||||
if course
|
if course
|
||||||
@state = 4
|
@state = 4
|
||||||
else
|
else
|
||||||
unless User.current.member_of_course? course
|
unless (allow_join && 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)
|
||||||
|
|
Loading…
Reference in New Issue