diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-01-05 19:22:07 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-01-05 19:22:14 +0100 |
commit | 21a713f9c48fb0be90da61321ecb75b3f27039d2 (patch) | |
tree | 31b0b492d98d5523fb1df7e081f1353a6f02be40 | |
parent | d66c48b303b00b731540dfa928ea151295ced5d4 (diff) | |
download | gitlab-ce-21a713f9c48fb0be90da61321ecb75b3f27039d2.tar.gz |
Change reset_cache action from get to post
4 files changed, 6 insertions, 7 deletions
diff --git a/app/assets/javascripts/pipelines/components/nav_controls.vue b/app/assets/javascripts/pipelines/components/nav_controls.vue index a5717c23a44..f2d5f76c0ce 100644 --- a/app/assets/javascripts/pipelines/components/nav_controls.vue +++ b/app/assets/javascripts/pipelines/components/nav_controls.vue @@ -50,10 +50,9 @@ export default { Get started with Pipelines </a> - <a :href="resetCachePath" - class="btn btn-default"> - Clear runner caches - </a> + <form :action="resetCachePath" method="post"> + <input type="submit" class="btn btn-default" value="Clear runner caches" /> + </form> <a :href="ciLintPath" diff --git a/config/routes/project.rb b/config/routes/project.rb index 2fbd7142501..bdf4b199c0a 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -409,7 +409,7 @@ constraints(ProjectUrlConstrainer.new) do namespace :settings do get :members, to: redirect("%{namespace_id}/%{project_id}/project_members") resource :ci_cd, only: [:show], controller: 'ci_cd' do - get :reset_cache + post :reset_cache end resource :integrations, only: [:show] resource :repository, only: [:show], controller: :repository diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb index e8ba04c7f24..0202149f335 100644 --- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb +++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb @@ -27,7 +27,7 @@ describe Projects::Settings::CiCdController do allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true) end - subject { get :reset_cache, namespace_id: project.namespace, project_id: project } + subject { post :reset_cache, namespace_id: project.namespace, project_id: project } it 'calls reset project cache service' do expect(ResetProjectCacheService).to receive_message_chain(:new, :execute) diff --git a/spec/javascripts/pipelines/nav_controls_spec.js b/spec/javascripts/pipelines/nav_controls_spec.js index 09a0c14d96c..cf9bbee2b13 100644 --- a/spec/javascripts/pipelines/nav_controls_spec.js +++ b/spec/javascripts/pipelines/nav_controls_spec.js @@ -58,7 +58,7 @@ describe('Pipelines Nav Controls', () => { }).$mount(); expect(component.$el.querySelectorAll('.btn-default')[0].textContent).toContain('Clear runner caches'); - expect(component.$el.querySelectorAll('.btn-default')[0].getAttribute('href')).toEqual(mockData.resetCachePath); + expect(component.$el.querySelector('form').getAttribute('action')).toEqual(mockData.resetCachePath); }); it('should render link for CI lint', () => { |