debian-mirror-gitlab/app/models/concerns/merge_request_reviewer_state.rb

20 lines
355 B
Ruby
Raw Normal View History

2021-12-11 22:18:48 +05:30
# frozen_string_literal: true
module MergeRequestReviewerState
extend ActiveSupport::Concern
included do
enum state: {
unreviewed: 0,
reviewed: 1,
attention_requested: 2
}
validates :state,
presence: true,
inclusion: { in: self.states.keys }
after_initialize :set_state, unless: :persisted?
end
end