Cell 2 cannot view a Project with commits if current user does not have a personal namespace
While investigating the issue #427661 (closed), I couldn't view a project page, when the project has any content/commits. For example when creating a project with a README file already.
The following two errors in this issue can be solved together, because they seem related (missing personal namespace on the current user), and they don't seem to have a big scope.
Note:
- The issues only prevent viewing the project, but not creating the project itself with a README file.
- I managed to avoid the error for a small demo by just creating a personal namespace on cell 2 for the
current_user
. But the projects were created on normal groups instead.
#420118 (closed)
Open Question: For the demo:- If we decide that it's ok to have a personal namespace on Cell 2, then this issue is not blocking anymore. What do you think?
Error 1
undefined method `find_fork_of' for nil:NilClass
namespace.find_fork_of(project)
Backtrace:
User#fork_of
app/models/user.rb, line 1360
User#already_forked?
app/models/user.rb, line 1356
#<Class:0x00000001682bc618>#fork_button_data_attributes
app/helpers/projects_helper.rb, line 431
#<Class:0x00000001682bc618>#_app_views_projects_buttons__fork_html_haml__257330920149757215_1148140
app/views/projects/buttons/_fork.html.haml, line 3
#<Class:0x00000001682bc618>#_app_views_projects__home_panel_html_haml___4472588927597436772_1112060
app/views/projects/_home_panel.html.haml, line 36
#<Class:0x00000001682bc618>#_app_views_projects_show_html_haml___3072978944903472855_1103300
app/views/projects/show.html.haml, line 16
ProjectsController#render
app/controllers/application_controller.rb, line 162
Can be solved by changing User#fork_of(project)
code to
def fork_of(project)
namespace&.find_fork_of(project)
end
See a related MR
Error 2:
Project#show
Breadcrumb fails to render in helpers/tree_helpers.rb
on Cell 2
Can be solved quickly locally by
- Changing reference in
tree_helpers.rb
tocurrent_user.namespace_id
instead ofcurrent_user.namespace.id
Edited by Omar Qunsul