From 8a4724cd461ce9ce69a3289eabc99742105993c5 Mon Sep 17 00:00:00 2001 From: Kenneth Chu Date: Wed, 22 Nov 2023 15:04:03 +1100 Subject: [PATCH] Show `email_reset_offered_at` to admin users Changelog: added --- app/views/admin/users/show.html.haml | 5 +++++ doc/api/users.md | 13 ++++++++++--- lib/api/entities/user_with_admin.rb | 1 + locale/gitlab.pot | 3 +++ spec/requests/api/users_spec.rb | 3 +++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index bee7e10906bde3..46fe6bed05ed35 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -128,6 +128,11 @@ %strong = Gitlab::Access.human_access_with_none(@user.highest_role) + %li + %span.light= _("Email reset removed at:") + %strong + = @user.email_reset_offered_at || _('never') + = render_if_exists 'admin/users/using_license_seat', user: @user - if @user.ldap_user? diff --git a/doc/api/users.md b/doc/api/users.md index 53f99bb59f4744..ad4e9c7f1b280e 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -136,6 +136,7 @@ GET /users?without_project_bots=true > - The `created_by` field in the response was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93092) in GitLab 15.6. > - The `scim_identities` field in the response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/324247) in GitLab 16.1. > - The `auditors` field in the response [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/418023) in GitLab 16.2. +> - The `email_reset_offered_at` field in the response [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137610) in GitLab 16.7. ```plaintext GET /users @@ -197,7 +198,8 @@ You can use all [parameters available for everyone](#for-non-administrator-users "current_sign_in_ip": "196.165.1.102", "last_sign_in_ip": "172.127.2.22", "namespace_id": 1, - "created_by": null + "created_by": null, + "email_reset_offered_at": null }, { "id": 2, @@ -235,7 +237,8 @@ You can use all [parameters available for everyone](#for-non-administrator-users "current_sign_in_ip": "10.165.1.102", "last_sign_in_ip": "172.127.2.22", "namespace_id": 2, - "created_by": null + "created_by": null, + "email_reset_offered_at": null } ] ``` @@ -380,6 +383,7 @@ Parameters: > - The `namespace_id` field in the response was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82045) in GitLab 14.10. > - The `created_by` field in the response was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93092) in GitLab 15.6. +> - The `email_reset_offered_at` field in the response [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137610) in GitLab 16.7. ```plaintext GET /users/:id @@ -445,7 +449,8 @@ Example Responses: "trial": true, "sign_in_count": 1337, "namespace_id": 1, - "created_by": null + "created_by": null, + "email_reset_offered_at": null } ``` @@ -728,6 +733,7 @@ Users on [GitLab Premium or Ultimate](https://about.gitlab.com/pricing/) also se > - The `namespace_id` field in the response was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82045) in GitLab 14.10. > - The `created_by` field in the response was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93092) in GitLab 15.6. +> - The `email_reset_offered_at` field in the response [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137610) in GitLab 16.7. ```plaintext GET /user @@ -783,6 +789,7 @@ Parameters: "last_sign_in_ip": "172.127.2.22", "namespace_id": 1, "created_by": null, + "email_reset_offered_at": null, "note": null } ``` diff --git a/lib/api/entities/user_with_admin.rb b/lib/api/entities/user_with_admin.rb index 53fef7a46e2f3f..25c1edb4526eb3 100644 --- a/lib/api/entities/user_with_admin.rb +++ b/lib/api/entities/user_with_admin.rb @@ -7,6 +7,7 @@ class UserWithAdmin < UserPublic expose :note expose :namespace_id expose :created_by, with: UserBasic + expose :email_reset_offered_at end end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 67b5d53a254b8c..87f71854629dad 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -18214,6 +18214,9 @@ msgstr "" msgid "Email patch" msgstr "" +msgid "Email reset removed at:" +msgstr "" + msgid "Email sent" msgstr "" diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index b63ea71efe6430..86c4e04ef71a4b 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -182,6 +182,7 @@ expect(json_response.first).not_to have_key('note') expect(json_response.first).not_to have_key('namespace_id') expect(json_response.first).not_to have_key('created_by') + expect(json_response.first).not_to have_key('email_reset_offered_at') end end @@ -194,6 +195,7 @@ expect(json_response.first).not_to have_key('note') expect(json_response.first).not_to have_key('namespace_id') expect(json_response.first).not_to have_key('created_by') + expect(json_response.first).not_to have_key('email_reset_offered_at') end end @@ -203,6 +205,7 @@ expect(response).to have_gitlab_http_status(:success) expect(json_response.first).to have_key('note') + expect(json_response.first).to have_key('email_reset_offered_at') expect(json_response.first['note']).to eq '2018-11-05 | 2FA removed | user requested | www.gitlab.com' end -- GitLab