debian-mirror-gitlab/app/models/resource_state_event.rb

24 lines
603 B
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
class ResourceStateEvent < ResourceEvent
include IssueResourceEvent
include MergeRequestResourceEvent
validate :exactly_one_issuable
2020-07-28 23:09:34 +05:30
belongs_to :source_merge_request, class_name: 'MergeRequest', foreign_key: :source_merge_request_id
2020-05-24 23:13:21 +05:30
# state is used for issue and merge request states.
enum state: Issue.available_states.merge(MergeRequest.available_states).merge(reopened: 5)
def self.issuable_attrs
%i(issue merge_request).freeze
end
2020-07-28 23:09:34 +05:30
def issuable
issue || merge_request
end
2020-05-24 23:13:21 +05:30
end
2020-11-24 15:15:51 +05:30
ResourceStateEvent.prepend_if_ee('EE::ResourceStateEvent')