summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2023-03-14 03:54:40 -0400
committerGitHub <noreply@github.com>2023-03-14 03:54:40 -0400
commitd56bb7420184c0c2f451f4bcaa96c9b3b00c393d (patch)
treedcf3c0f696d2142e330d3d07b005db0bae8bbe97 /services
parent03591f0f95823a0b1dcca969d2a3ed505c7e6d73 (diff)
downloadgitea-d56bb7420184c0c2f451f4bcaa96c9b3b00c393d.tar.gz
gitea-d56bb7420184c0c2f451f4bcaa96c9b3b00c393d.zip
add admin API email endpoints (#22792)
add email endpoint to admin API to ensure API parity with admin dashboard.
Diffstat (limited to 'services')
-rw-r--r--services/convert/convert.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/services/convert/convert.go b/services/convert/convert.go
index 5f2100a039..bce0e7ba21 100644
--- a/services/convert/convert.go
+++ b/services/convert/convert.go
@@ -38,6 +38,17 @@ func ToEmail(email *user_model.EmailAddress) *api.Email {
}
}
+// ToEmail convert models.EmailAddress to api.Email
+func ToEmailSearch(email *user_model.SearchEmailResult) *api.Email {
+ return &api.Email{
+ Email: email.Email,
+ Verified: email.IsActivated,
+ Primary: email.IsPrimary,
+ UserID: email.UID,
+ UserName: email.Name,
+ }
+}
+
// ToBranch convert a git.Commit and git.Branch to an api.Branch
func ToBranch(ctx context.Context, repo *repo_model.Repository, b *git.Branch, c *git.Commit, bp *git_model.ProtectedBranch, user *user_model.User, isRepoAdmin bool) (*api.Branch, error) {
if bp == nil {