NoMethodError: Undefined method "public?" for Namespace when check_namespace_plan: true

Summary

Seen in my local GDK, trying to visit a project page. This also happens against EE v9.4.0rc3

NoMethodError - undefined method `public?' for #<Namespace:0x00558e78734590>
Did you mean?  public_send:
  activemodel (4.2.8) lib/active_model/attribute_methods.rb:433:in `method_missing'
  app/models/ee/project.rb:489:in `load_licensed_feature_available'
  app/models/ee/project.rb:478:in `block in licensed_feature_available?'
  app/models/ee/project.rb:481:in `licensed_feature_available?'
  app/models/ee/project.rb:185:in `feature_available?'
  app/helpers/tree_helper.rb:112:in `lock_file_link'
  app/views/projects/tree/_tree_header.html.haml:78:in `_app_views_projects_tree__tree_header_html_haml___3530477117632729230_47035086724580'

Steps to reproduce

  • Enable check_license_plan in ApplicationSettings
  • Visit a personal project (in this case, a fork: /root/gitlab-shell)

What is the current bug behavior?

500 error

What is the expected correct behavior?

200 success

Possible fixes

include Gitlab::VisibilityLevel is in group, not namespace. A personal project returns an instance of Namespace for namespace, not Group.

Can we promote include Gitlab::VisibilityLevel to Namespace? Or is it safer to check this case in licensed_feature_available? explicitly?

Edited Jul 17, 2017 by Nick Thomas
Assignee Loading
Time tracking Loading