2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
class IssueEntity < IssuableEntity
|
2018-03-17 18:26:18 +05:30
|
|
|
include TimeTrackableEntity
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expose :state
|
|
|
|
expose :milestone_id
|
|
|
|
expose :updated_by_id
|
|
|
|
expose :created_at
|
|
|
|
expose :updated_at
|
|
|
|
expose :milestone, using: API::Entities::Milestone
|
|
|
|
expose :labels, using: LabelEntity
|
|
|
|
expose :lock_version
|
|
|
|
expose :author_id
|
2017-08-17 22:00:37 +05:30
|
|
|
expose :confidential
|
2018-03-17 18:26:18 +05:30
|
|
|
expose :discussion_locked
|
2017-08-17 22:00:37 +05:30
|
|
|
expose :assignees, using: API::Entities::UserBasic
|
|
|
|
expose :due_date
|
|
|
|
expose :moved_to_id
|
|
|
|
expose :project_id
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
expose :web_url do |issue|
|
|
|
|
project_issue_path(issue.project, issue)
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expose :current_user do
|
|
|
|
expose :can_create_note do |issue|
|
|
|
|
can?(request.current_user, :create_note, issue)
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :can_update do |issue|
|
|
|
|
can?(request.current_user, :update_issue, issue)
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
expose :can_award_emoji do |issue|
|
|
|
|
can?(request.current_user, :award_emoji, issue)
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
expose :create_note_path do |issue|
|
|
|
|
project_notes_path(issue.project, target_type: 'issue', target_id: issue.id)
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :preview_note_path do |issue|
|
2018-12-05 23:21:45 +05:30
|
|
|
preview_markdown_path(issue.project, quick_actions_target_type: 'Issue', quick_actions_target_id: issue.iid)
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|