2021-10-25 05:12:21 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module MergeRequestReviewerState
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
enum state: {
|
|
|
|
unreviewed: 0,
|
|
|
|
reviewed: 1,
|
2021-11-16 19:12:37 -05:00
|
|
|
attention_requested: 2
|
2021-10-25 05:12:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
validates :state,
|
|
|
|
presence: true,
|
|
|
|
inclusion: { in: self.states.keys }
|
2021-11-03 02:10:20 -04:00
|
|
|
|
|
|
|
after_initialize :set_state, unless: :persisted?
|
2021-10-25 05:12:21 -04:00
|
|
|
end
|
|
|
|
end
|