Sha256: 30d18265c681d49dc6ef494154c90a14a426e20800a469c90b50574503868d85
Contents?: true
Size: 1.03 KB
Versions: 15
Compression:
Stored size: 1.03 KB
Contents
module Shipit module Api class PullRequestsController < BaseController require_permission :read, :stack require_permission :deploy, :stack, only: %i(update destroy) def index render_resources stack.pull_requests.includes(:head).order(id: :desc) end def show render_resource stack.pull_requests.find_by!(number: params[:id]) end def update pull_request = PullRequest.request_merge!(stack, params[:id], current_user) if pull_request.waiting? head :accepted elsif pull_request.merged? render status: :method_not_allowed, json: { message: "This pull request was already merged.", } else raise "Pull Request is neither waiting nor merged, this should be impossible" end end def destroy if pull_request = stack.pull_requests.where(number: params[:id]).first pull_request.cancel! if pull_request.waiting? end head :no_content end end end end
Version data entries
15 entries across 15 versions & 1 rubygems