summaryrefslogtreecommitdiff
path: root/app/models/issue.rb
diff options
context:
space:
mode:
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