Sha256: 75176f3f3163e005721fe7a6b80c027226fc2ed019c5509c700c087199464819

Contents?: true

Size: 599 Bytes

Versions: 10

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true
module Shipit
  class CommitsController < ShipitController
    def update
      if update_params[:locked].present?
        if Shipit::CastValue.to_boolean(update_params[:locked])
          commit.lock(current_user)
        else
          commit.unlock
        end
      end

      head(:ok)
    end

    private

    def commit
      @commit ||= stack.commits.find(params[:id])
    end

    def stack
      @stack ||= Stack.from_param!(params[:stack_id])
    end

    def update_params
      @update_params ||= params.require(:commit).permit(:locked)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.38.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.37.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.36.1 app/controllers/shipit/commits_controller.rb
shipit-engine-0.36.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.35.1 app/controllers/shipit/commits_controller.rb
shipit-engine-0.35.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.34.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.33.0 app/controllers/shipit/commits_controller.rb
shipit-engine-0.32.0 app/controllers/shipit/commits_controller.rb