Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-10-05 20:02:50 +0300
committerRémy Coutable <remy@rymai.me>2017-10-09 17:44:47 +0300
commitf070265a6ddd0173c8924bfcd7791ecafa15ab7e (patch)
treecf364687889aa546f39b607aa57db839d7059c97 /app/models/issue.rb
parent075d6516047d899746d22b5323d3b74558e200d0 (diff)
Introduce new hook data builders for Issue and MergeRequest
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb52
1 files changed, 1 insertions, 51 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 2527622a989..36e4108b9d6 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -18,36 +18,6 @@ class Issue < ActiveRecord::Base
DueThisWeek = DueDateStruct.new('Due This Week', 'week').freeze
DueThisMonth = DueDateStruct.new('Due This Month', 'month').freeze
- SAFE_HOOK_ATTRIBUTES = %i[
- assignee_id
- author_id
- branch_name
- closed_at
- confidential
- created_at
- deleted_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
- ].freeze
-
belongs_to :project
belongs_to :moved_to, class_name: 'Issue'
@@ -147,28 +117,8 @@ class Issue < ActiveRecord::Base
"id DESC")
end
- def self.safe_hook_attributes
- SAFE_HOOK_ATTRIBUTES
- end
-
- def self.safe_hook_relations
- SAFE_HOOK_RELATIONS
- end
-
def hook_attrs
- assignee_ids = self.assignee_ids
-
- attrs = {
- url: Gitlab::UrlBuilder.build(self),
- total_time_spent: total_time_spent,
- human_total_time_spent: human_total_time_spent,
- human_time_estimate: human_time_estimate,
- assignee_ids: assignee_ids,
- assignee_id: assignee_ids.first # This key is deprecated
- }
-
- attributes.with_indifferent_access.slice(*self.class.safe_hook_attributes)
- .merge!(attrs)
+ Gitlab::HookData::IssueBuilder.new(self).build
end
# Returns a Hash of attributes to be used for Twitter card metadata