Browse Source

fix: profile completed

tags/v3.2.0
yystopf 4 years ago
parent
commit
a2ae8f1630
2 changed files with 6 additions and 6 deletions
  1. +5
    -5
      app/models/user.rb
  2. +1
    -1
      app/views/users/get_user_info.json.jbuilder

+ 5
- 5
app/models/user.rb View File

@@ -186,7 +186,7 @@ class User < Owner
:show_email, :show_location, :show_department,
:technical_title, :province, :city, :custom_department, to: :user_extension, allow_nil: true

before_save :update_hashed_password, :set_lastname, :set_profile_completed
before_save :update_hashed_password, :set_lastname
after_create do
SyncTrustieJob.perform_later("user", 1) if allow_sync_to_trustie?
end
@@ -757,6 +757,10 @@ class User < Owner
laboratory_id.present? && laboratory_id != 1
end

def profile_is_completed?
self.nickname.present? && self.gender.present? && self.mail.present? && self.custom_department.present?
end

protected
def validate_password_length
# 管理员的初始密码是5位
@@ -783,10 +787,6 @@ class User < Owner
def set_lastname
self.lastname = self.nickname if changes[:nickname].present?
end

def set_profile_completed
self.profile_completed = self.nickname.present? && self.gender.present? && self.mail.present? && self.custom_department.present?
end
end




+ 1
- 1
app/views/users/get_user_info.json.jbuilder View File

@@ -12,7 +12,7 @@ json.tidding_count 0
json.user_phone_binded @user.phone.present?
# json.phone @user.phone
# json.email @user.mail
json.profile_completed @user.profile_completed?
json.profile_completed @user.profile_is_completed?
json.professional_certification @user.professional_certification
json.devops_step @user.devops_step
json.ci_certification @user.ci_certification?


Loading…
Cancel
Save