Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
28ab9662
Commit
28ab9662
authored
Aug 21, 2018
by
Chantal Rollison
Committed by
Rémy Coutable
Aug 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port of ccr/6274/add_weight_to_payload to CE
parent
edf7d1d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
62 deletions
+66
-62
lib/gitlab/hook_data/issuable_builder.rb
lib/gitlab/hook_data/issuable_builder.rb
+1
-1
lib/gitlab/hook_data/issue_builder.rb
lib/gitlab/hook_data/issue_builder.rb
+34
-32
lib/gitlab/hook_data/merge_request_builder.rb
lib/gitlab/hook_data/merge_request_builder.rb
+31
-29
No files found.
lib/gitlab/hook_data/issuable_builder.rb
View file @
28ab9662
...
...
@@ -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
...
...
lib/gitlab/hook_data/issue_builder.rb
View file @
28ab9662
module
Gitlab
module
HookData
class
IssueBuilder
<
BaseBuilder
SAFE_HOOK_ATTRIBUTES
=
%i[
assignee_id
author_id
closed_at
confidential
created_at
description
due_date
id
iid
last_edited_at
last_edited_by_id
milestone_id
moved_to_id
project_id
relative_position
state
time_estimate
title
updated_at
updated_by_id
]
.
freeze
SAFE_HOOK_RELATIONS
=
%i[
assignees
labels
total_time_spent
]
.
freeze
def
self
.
safe_hook_attributes
%i[
assignee_id
author_id
closed_at
confidential
created_at
description
due_date
id
iid
last_edited_at
last_edited_by_id
milestone_id
moved_to_id
project_id
relative_position
state
time_estimate
title
updated_at
updated_by_id
]
.
freeze
end
alias_method
:issue
,
:object
def
build
attrs
=
{
description:
absolute_image_urls
(
issue
.
description
),
url:
Gitlab
::
UrlBuilder
.
build
(
issue
),
total_time_spent:
issue
.
total_time_spent
,
human_total_time_spent:
issue
.
human_total_time_spent
,
human_time_estimate:
issue
.
human_time_estimate
,
assignee_ids:
issue
.
assignee_ids
,
assignee_id:
issue
.
assignee_ids
.
first
# This key is deprecated
description:
absolute_image_urls
(
issue
.
description
),
url:
Gitlab
::
UrlBuilder
.
build
(
issue
),
total_time_spent:
issue
.
total_time_spent
,
human_total_time_spent:
issue
.
human_total_time_spent
,
human_time_estimate:
issue
.
human_time_estimate
,
assignee_ids:
issue
.
assignee_ids
,
assignee_id:
issue
.
assignee_ids
.
first
# This key is deprecated
}
issue
.
attributes
.
with_indifferent_access
.
slice
(
*
SAFE_HOOK_ATTRIBUTES
)
.
merge!
(
attrs
)
issue
.
attributes
.
with_indifferent_access
.
slice
(
*
self
.
class
.
safe_hook_attributes
)
.
merge!
(
attrs
)
end
end
end
...
...
lib/gitlab/hook_data/merge_request_builder.rb
View file @
28ab9662
module
Gitlab
module
HookData
class
MergeRequestBuilder
<
BaseBuilder
SAFE_HOOK_ATTRIBUTES
=
%i[
assignee_id
author_id
created_at
description
head_pipeline_id
id
iid
last_edited_at
last_edited_by_id
merge_commit_sha
merge_error
merge_params
merge_status
merge_user_id
merge_when_pipeline_succeeds
milestone_id
source_branch
source_project_id
state
target_branch
target_project_id
time_estimate
title
updated_at
updated_by_id
]
.
freeze
def
self
.
safe_hook_attributes
%i[
assignee_id
author_id
created_at
description
head_pipeline_id
id
iid
last_edited_at
last_edited_by_id
merge_commit_sha
merge_error
merge_params
merge_status
merge_user_id
merge_when_pipeline_succeeds
milestone_id
source_branch
source_project_id
state
target_branch
target_project_id
time_estimate
title
updated_at
updated_by_id
]
.
freeze
end
SAFE_HOOK_RELATIONS
=
%i[
assignee
...
...
@@ -50,8 +52,8 @@ module Gitlab
human_time_estimate:
merge_request
.
human_time_estimate
}
merge_request
.
attributes
.
with_indifferent_access
.
slice
(
*
SAFE_HOOK_ATTRIBUTES
)
.
merge!
(
attrs
)
merge_request
.
attributes
.
with_indifferent_access
.
slice
(
*
self
.
class
.
safe_hook_attributes
)
.
merge!
(
attrs
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment