issues25489
cxt 5 years ago
parent 960d2674c8
commit e1fc3fff3e

@ -1141,7 +1141,7 @@ class CoursesController < ApplicationController
# 如果在该课堂已经存在学生身份,且邀请码为分班邀请码,则将其直接加入分班
existing_student.update_attributes(course_group_id: course_group.id) if course_group.present?
else
correspond_teacher_exist = current_user.teacher_of_course? course
correspond_teacher_exist = current_user.none_admin_teacher_of_course? course
new_student = CourseMember.new(user_id: current_user.id, course_id: course.id, role: 4)
new_student.is_active = 0 if correspond_teacher_exist

@ -287,6 +287,11 @@ class User < ApplicationRecord
course.course_members.exists?(user_id: id, role: [1,2,3], is_active: 1) || admin? || business?
end
# 课堂的老师(创建者、老师、助教),不考虑超管和运营人员
def none_admin_teacher_of_course?(course)
course.course_members.exists?(user_id: id, role: [1,2,3], is_active: 1)
end
# 课堂的老师(创建者、老师、助教),不用考虑当前身份
def teacher_of_course_non_active?(course)
course.course_members.exists?(user_id: id, role: [1,2,3])

@ -3,8 +3,8 @@ json.author do
end
json.id message.id
json.content content_safe(message.contents_show(identity))
# json.content message.contents_show(identity)
# json.content content_safe(message.contents_show(identity))
json.content message.contents_show(identity)
json.time time_from_now(message.created_at)
json.hidden message.hidden
# 主贴与子贴不一致

Loading…
Cancel
Save