summaryrefslogtreecommitdiff
path: root/app/services/protected_branches/update_service.rb
blob: 4a2b1be9c9380e96a8addc6d09f260756226cc80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module ProtectedBranches
  class UpdateService < ProtectedBranches::BaseService
    attr_reader :protected_branch

    def initialize(project, current_user, id, params = {})
      super(project, current_user, params)
      @id = id
    end

    def execute
      ProtectedBranch.transaction do
        @protected_branch = ProtectedBranch.find(@id)
        set_access_levels!
      end

      true
    rescue ActiveRecord::RecordInvalid
      false
    end
  end
end