blob: 893d06b4da8364a4622f1a3c629f7c7e2051b687 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# 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 }
belongs_to :updated_state_by, class_name: 'User', foreign_key: :updated_state_by_user_id
after_initialize :set_state, unless: :persisted?
def attention_requested_by
return unless attention_requested?
updated_state_by
end
end
end
|