BigW Consortium Gitlab
Fix protected branches routing ### Summary On the master branch, if you attempt to access the protected branches in the project settings with an empty repo, you get `NoMethodError - undefined method "project_url"`. ### Steps to reproduce 1. Check out GitLab master and run. 2. Create a new project. 3. Go to Settings. 4. Click on "Protected branches" ### Expected behavior The controller is supposed to redirect back to the projects page since there are no branches. ### Observed behavior Internal Error 500 ### Relevant logs ``` NoMethodError - undefined method `project_url' for #<Projects::ProtectedBranchesController:0x007fd920054af0>: app/controllers/application_controller.rb:157:in `method_missing' actionpack (4.1.9) lib/action_dispatch/routing/polymorphic_routes.rb:142:in `polymorphic_url' actionpack (4.1.9) lib/action_dispatch/routing/url_for.rb:161:in `url_for' actionpack (4.1.9) lib/action_controller/metal/redirecting.rb:91:in `_compute_redirect_to_location' turbolinks (2.0.0) lib/turbolinks.rb:15:in `_compute_redirect_to_location_with_xhr_referer' actionpack (4.1.9) lib/action_controller/metal/redirecting.rb:71:in `redirect_to ``` ### Fix I added a unit test for the empty project case and replicated the issue. I added the URL router helpers that appear to be necessary after 42387b73. See merge request !359
Name |
Last commit
|
Last update |
---|---|---|
app | Loading commit data... | |
bin | Loading commit data... | |
config | Loading commit data... | |
db | Loading commit data... | |
doc | Loading commit data... | |
docker | Loading commit data... | |
features | Loading commit data... | |
lib | Loading commit data... | |
log | Loading commit data... | |
public | Loading commit data... | |
safe | Loading commit data... | |
spec | Loading commit data... | |
tmp | Loading commit data... | |
vendor/assets | Loading commit data... | |
.foreman | Loading commit data... | |
.gitattributes | Loading commit data... | |
.gitignore | Loading commit data... | |
.hound.yml | Loading commit data... | |
.pkgr.yml | Loading commit data... | |
.rspec | Loading commit data... | |
.rubocop.yml | Loading commit data... | |
.ruby-version | Loading commit data... | |
.simplecov | Loading commit data... | |
.teatro.yml | Loading commit data... | |
CHANGELOG | Loading commit data... | |
CONTRIBUTING.md | Loading commit data... | |
GITLAB_SHELL_VERSION | Loading commit data... | |
Gemfile | Loading commit data... | |
Gemfile.lock | Loading commit data... | |
Guardfile | Loading commit data... | |
LICENSE | Loading commit data... | |
MAINTENANCE.md | Loading commit data... | |
PROCESS.md | Loading commit data... | |
Procfile | Loading commit data... | |
README.md | Loading commit data... | |
Rakefile | Loading commit data... | |
VERSION | Loading commit data... | |
config.ru | Loading commit data... |