@ -424,6 +424,10 @@ class User < ApplicationRecord
end
def is_collect? container
collections.where(container: container).exists?
# 实训用户身份
def shixun_identity(shixun)
@identity =
@ -649,10 +653,6 @@ class User < ApplicationRecord
Educoder::Utils.random_hex(16)
# 全部已认证
def all_certified?
authentication? && professional_certification?
@ -1,6 +1,6 @@
json.fork_from @fork_from
json.identity User.current.shixun_identity(@shixun)
json.is_collect @user.is_collect?(@shixun)
json.is_collect @user&.is_collect?(@shixun)
json.power @power
json.partial! 'shixuns/top', locals: { shixun: @shixun, current_myshixun: @current_myshixun }
@ -5,7 +5,7 @@ json.challenges_count @subject.subject_challenge_count
json.subject_score @subject.all_score
json.member_count @subject.member_count
json.is_collect @user.is_collect?(@subject)
json.is_collect @user&.is_collect?(@subject)
json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin?
json.publish_status publish_status(@subject, @is_manager)