diff options
Diffstat (limited to 'app/controllers/commits_controller.rb')
-rw-r--r-- | app/controllers/commits_controller.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb index 06c24d6..88306f3 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/commits_controller.rb @@ -3,7 +3,8 @@ class CommitsController < ApplicationController before_filter :authenticate_public_page!, only: :show before_filter :project before_filter :commit - before_filter :authorize_access_project!, except: [:status, :show] + before_filter :authorize_access_project!, except: [:status, :show, :cancel] + before_filter :authorize_project_developer!, only: [:cancel] def show @builds = @commit.builds @@ -13,6 +14,12 @@ class CommitsController < ApplicationController render json: @commit.to_json(only: [:id, :sha], methods: [:status, :coverage]) end + def cancel + commit.builds.running_or_pending.each(&:cancel) + + redirect_to project_ref_commit_path(project, commit.ref, commit.sha) + end + private def project |