FIX find educoder project's bug

This commit is contained in:
Jasder 2020-11-11 10:14:41 +08:00
parent b5d3f32d68
commit 0ca699cc49
1 changed files with 1 additions and 3 deletions

View File

@ -179,9 +179,7 @@ class Project < ApplicationRecord
logger.info "########namespace_path: #{namespace_path} ########identifier: #{identifier} "
user = User.find_by_login namespace_path
return nil if user.blank?
project = user.projects.find_by(identifier: identifier) || Project.find_by(identifier: "#{namespace_path}/#{identifier}")
project = user&.projects&.find_by(identifier: identifier) || Project.find_by(identifier: "#{namespace_path}/#{identifier}")
return nil if project.blank?
[project, user]