Commit 5050cc0a authored by Kerri Miller's avatar Kerri Miller

Merge branch 'expose-resolved_at-via-api' into 'master'

Expose notes.resolved_at via api

See merge request gitlab-org/gitlab!49821
parents a6686e3a 40cc3d3e
---
title: Expose notes resolved_at via API
merge_request: 49821
author: Lee Tickett
type: added
......@@ -687,7 +687,8 @@ GET /projects/:id/merge_requests/:merge_request_iid/discussions
"noteable_iid": null,
"resolved": false,
"resolvable": true,
"resolved_by": null
"resolved_by": null,
"resolved_at": null
},
{
"id": 1129,
......
......@@ -23,6 +23,7 @@ module API
expose :resolvable?, as: :resolvable
expose :resolved?, as: :resolved, if: ->(note, options) { note.resolvable? }
expose :resolved_by, using: Entities::UserBasic, if: ->(note, options) { note.resolvable? }
expose :resolved_at, if: ->(note, options) { note.resolvable? }
expose :confidential?, as: :confidential
......
......@@ -48,6 +48,7 @@
"resolved": { "type": "boolean" },
"resolvable": { "type": "boolean" },
"resolved_by": { "type": ["string", "null"] },
"resolved_at": { "type": ["date", "null"] },
"note": { "type": "string" },
"note_html": { "type": "string" },
"current_user": { "type": "object" },
......
......@@ -31,6 +31,7 @@
"resolved": { "type": "boolean" },
"resolvable": { "type": "boolean" },
"resolved_by": { "type": ["string", "null"] },
"resolved_at": { "type": ["date", "null"] },
"confidential": { "type": ["boolean", "null"] }
},
"required": [
......
......@@ -9,6 +9,7 @@ RSpec.shared_examples 'resolvable discussions API' do |parent_type, noteable_typ
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['notes'].size).to eq(1)
expect(json_response['notes'][0]['resolved']).to eq(true)
expect(Time.parse(json_response['notes'][0]['resolved_at'])).to be_like_time(note.reload.resolved_at)
end
it "unresolves discussion if resolved is false" do
......@@ -18,6 +19,7 @@ RSpec.shared_examples 'resolvable discussions API' do |parent_type, noteable_typ
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['notes'].size).to eq(1)
expect(json_response['notes'][0]['resolved']).to eq(false)
expect(json_response['notes'][0]['resolved_at']).to be_nil
end
it "returns a 400 bad request error if resolved parameter is not passed" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment