Commit e295483f authored by Serena Fang's avatar Serena Fang

Expose confirmed at instead of confirmed

Confirmation time is more useful, if a user wants the boolean
they can use !confirmed_at.nil?
parent 76654c26
---
title: Return whether an email is verified from email entity
title: Return email confirmation time from email entity
merge_request: 58957
author:
type: changed
......@@ -1214,12 +1214,12 @@ GET /user/emails
{
"id": 1,
"email": "email@example.com",
"confirmed?" : true
"confirmed_at" : "2021-03-26T19:07:56.248Z"
},
{
"id": 3,
"email": "email2@example.com",
"confirmed?" : false
"confirmed_at" : null
}
]
```
......@@ -1260,7 +1260,7 @@ Parameters:
{
"id": 1,
"email": "email@example.com",
"confirmed?" : true
"confirmed_at" : "2021-03-26T19:07:56.248Z"
}
```
......@@ -1280,7 +1280,7 @@ Parameters:
{
"id": 4,
"email": "email@example.com",
"confirmed?" : true
"confirmed_at" : "2021-03-26T19:07:56.248Z"
}
```
......
......@@ -3,7 +3,7 @@
module API
module Entities
class Email < Grape::Entity
expose :id, :email, :confirmed?
expose :id, :email, :confirmed_at
end
end
end
......@@ -1795,7 +1795,7 @@ RSpec.describe API::Users do
post api("/users/#{user.id}/emails", admin), params: email_attrs
end.to change { user.emails.count }.by(1)
expect(json_response['confirmed?']).to be_falsey
expect(json_response['confirmed_at']).to be_nil
end
it "returns a 400 for invalid ID" do
......@@ -1812,7 +1812,7 @@ RSpec.describe API::Users do
expect(response).to have_gitlab_http_status(:created)
expect(json_response['confirmed?']).to be_truthy
expect(json_response['confirmed_at']).not_to be_nil
end
end
......
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