Commit 40cc3d3e authored by Lee Tickett's avatar Lee Tickett Committed by Kerri Miller

Expose notes.resolved_at via api

parent 40952ad9
---
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 ...@@ -687,7 +687,8 @@ GET /projects/:id/merge_requests/:merge_request_iid/discussions
"noteable_iid": null, "noteable_iid": null,
"resolved": false, "resolved": false,
"resolvable": true, "resolvable": true,
"resolved_by": null "resolved_by": null,
"resolved_at": null
}, },
{ {
"id": 1129, "id": 1129,
......
...@@ -23,6 +23,7 @@ module API ...@@ -23,6 +23,7 @@ module API
expose :resolvable?, as: :resolvable expose :resolvable?, as: :resolvable
expose :resolved?, as: :resolved, if: ->(note, options) { note.resolvable? } expose :resolved?, as: :resolved, if: ->(note, options) { note.resolvable? }
expose :resolved_by, using: Entities::UserBasic, 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 expose :confidential?, as: :confidential
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
"resolved": { "type": "boolean" }, "resolved": { "type": "boolean" },
"resolvable": { "type": "boolean" }, "resolvable": { "type": "boolean" },
"resolved_by": { "type": ["string", "null"] }, "resolved_by": { "type": ["string", "null"] },
"resolved_at": { "type": ["date", "null"] },
"note": { "type": "string" }, "note": { "type": "string" },
"note_html": { "type": "string" }, "note_html": { "type": "string" },
"current_user": { "type": "object" }, "current_user": { "type": "object" },
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
"resolved": { "type": "boolean" }, "resolved": { "type": "boolean" },
"resolvable": { "type": "boolean" }, "resolvable": { "type": "boolean" },
"resolved_by": { "type": ["string", "null"] }, "resolved_by": { "type": ["string", "null"] },
"resolved_at": { "type": ["date", "null"] },
"confidential": { "type": ["boolean", "null"] } "confidential": { "type": ["boolean", "null"] }
}, },
"required": [ "required": [
......
...@@ -9,6 +9,7 @@ RSpec.shared_examples 'resolvable discussions API' do |parent_type, noteable_typ ...@@ -9,6 +9,7 @@ RSpec.shared_examples 'resolvable discussions API' do |parent_type, noteable_typ
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['notes'].size).to eq(1) expect(json_response['notes'].size).to eq(1)
expect(json_response['notes'][0]['resolved']).to eq(true) 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 end
it "unresolves discussion if resolved is false" do it "unresolves discussion if resolved is false" do
...@@ -18,6 +19,7 @@ RSpec.shared_examples 'resolvable discussions API' do |parent_type, noteable_typ ...@@ -18,6 +19,7 @@ RSpec.shared_examples 'resolvable discussions API' do |parent_type, noteable_typ
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['notes'].size).to eq(1) expect(json_response['notes'].size).to eq(1)
expect(json_response['notes'][0]['resolved']).to eq(false) expect(json_response['notes'][0]['resolved']).to eq(false)
expect(json_response['notes'][0]['resolved_at']).to be_nil
end end
it "returns a 400 bad request error if resolved parameter is not passed" do 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