Port of ccr/6274/add_weight_to_payload to CE
This commit is contained in:
parent
edf7d1d4c7
commit
28ab966210
|
|
@ -28,7 +28,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def safe_keys
|
||||
issuable_builder::SAFE_HOOK_ATTRIBUTES + issuable_builder::SAFE_HOOK_RELATIONS
|
||||
issuable_builder.safe_hook_attributes + issuable_builder::SAFE_HOOK_RELATIONS
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
module Gitlab
|
||||
module HookData
|
||||
class IssueBuilder < BaseBuilder
|
||||
SAFE_HOOK_ATTRIBUTES = %i[
|
||||
SAFE_HOOK_RELATIONS = %i[
|
||||
assignees
|
||||
labels
|
||||
total_time_spent
|
||||
].freeze
|
||||
|
||||
def self.safe_hook_attributes
|
||||
%i[
|
||||
assignee_id
|
||||
author_id
|
||||
closed_at
|
||||
|
|
@ -23,12 +30,7 @@ module Gitlab
|
|||
updated_at
|
||||
updated_by_id
|
||||
].freeze
|
||||
|
||||
SAFE_HOOK_RELATIONS = %i[
|
||||
assignees
|
||||
labels
|
||||
total_time_spent
|
||||
].freeze
|
||||
end
|
||||
|
||||
alias_method :issue, :object
|
||||
|
||||
|
|
@ -43,7 +45,7 @@ module Gitlab
|
|||
assignee_id: issue.assignee_ids.first # This key is deprecated
|
||||
}
|
||||
|
||||
issue.attributes.with_indifferent_access.slice(*SAFE_HOOK_ATTRIBUTES)
|
||||
issue.attributes.with_indifferent_access.slice(*self.class.safe_hook_attributes)
|
||||
.merge!(attrs)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
module Gitlab
|
||||
module HookData
|
||||
class MergeRequestBuilder < BaseBuilder
|
||||
SAFE_HOOK_ATTRIBUTES = %i[
|
||||
def self.safe_hook_attributes
|
||||
%i[
|
||||
assignee_id
|
||||
author_id
|
||||
created_at
|
||||
|
|
@ -28,6 +29,7 @@ module Gitlab
|
|||
updated_at
|
||||
updated_by_id
|
||||
].freeze
|
||||
end
|
||||
|
||||
SAFE_HOOK_RELATIONS = %i[
|
||||
assignee
|
||||
|
|
@ -50,7 +52,7 @@ module Gitlab
|
|||
human_time_estimate: merge_request.human_time_estimate
|
||||
}
|
||||
|
||||
merge_request.attributes.with_indifferent_access.slice(*SAFE_HOOK_ATTRIBUTES)
|
||||
merge_request.attributes.with_indifferent_access.slice(*self.class.safe_hook_attributes)
|
||||
.merge!(attrs)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue