diff options
Diffstat (limited to 'app/serializers/issue_entity.rb')
-rw-r--r-- | app/serializers/issue_entity.rb | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb index 35df95549b7..b5e2334b6e3 100644 --- a/app/serializers/issue_entity.rb +++ b/app/serializers/issue_entity.rb @@ -1,16 +1,41 @@ class IssueEntity < IssuableEntity - include RequestAwareEntity + include TimeTrackableEntity - expose :branch_name + 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 expose :confidential + expose :discussion_locked expose :assignees, using: API::Entities::UserBasic expose :due_date expose :moved_to_id expose :project_id - expose :milestone, using: API::Entities::Milestone - expose :labels, using: LabelEntity expose :web_url do |issue| - namespace_project_issue_path(issue.project.namespace, issue.project, issue) + project_issue_path(issue.project, issue) + end + + 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 + 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| + preview_markdown_path(issue.project, quick_actions_target_type: 'Issue', quick_actions_target_id: issue.id) end end |