This commit is contained in:
parent
40217d5c56
commit
fc5895e74f
|
@ -334,7 +334,7 @@ class CoursesService
|
||||||
if current_user.member_of_course?(course) #如果已经是成员
|
if current_user.member_of_course?(course) #如果已经是成员
|
||||||
member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
|
member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
|
||||||
roleName = member.roles[0].name if member
|
roleName = member.roles[0].name if member
|
||||||
if params[:course_password] == course.password
|
if params[:course_password] == course.password || params[:invite_code].present?
|
||||||
#如果加入角色为学生 并且当前是学生
|
#如果加入角色为学生 并且当前是学生
|
||||||
if params[:role] == "10" && roleName == "Student"
|
if params[:role] == "10" && roleName == "Student"
|
||||||
@state = 3
|
@state = 3
|
||||||
|
@ -367,7 +367,7 @@ class CoursesService
|
||||||
@state = 1
|
@state = 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if params[:course_password] == course.password
|
if params[:course_password] == course.password || params[:invite_code].present?
|
||||||
if params[:role] == "10" || params[:role] == nil
|
if params[:role] == "10" || params[:role] == nil
|
||||||
members = []
|
members = []
|
||||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||||
|
|
Loading…
Reference in New Issue