2020-10-24 23:57:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ResourceTimeboxEvent < ResourceEvent
|
|
|
|
self.abstract_class = true
|
|
|
|
|
|
|
|
include IssueResourceEvent
|
|
|
|
include MergeRequestResourceEvent
|
|
|
|
|
|
|
|
validate :exactly_one_issuable
|
|
|
|
|
|
|
|
enum action: {
|
|
|
|
add: 1,
|
|
|
|
remove: 2
|
|
|
|
}
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
after_save :usage_metrics
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
def self.issuable_attrs
|
|
|
|
%i(issue merge_request).freeze
|
|
|
|
end
|
|
|
|
|
|
|
|
def issuable
|
|
|
|
issue || merge_request
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def usage_metrics
|
|
|
|
case self
|
|
|
|
when ResourceMilestoneEvent
|
|
|
|
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_milestone_changed_action(author: user)
|
|
|
|
when ResourceIterationEvent
|
|
|
|
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_iteration_changed_action(author: user)
|
|
|
|
else
|
|
|
|
# no-op
|
|
|
|
end
|
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|