1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-06 10:25:22 +02:00

[refactor] Unify the export of user data via API (#15144)

* [refactor] unify how user data is exported via API

* test time via unix timestamp
This commit is contained in:
6543 2021-03-27 17:45:26 +01:00 committed by GitHub
parent f4d27498bd
commit 290cf75f93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 117 additions and 97 deletions

View file

@ -75,7 +75,7 @@ func Search(ctx *context.APIContext) {
results := make([]*api.User, len(users))
for i := range users {
results[i] = convert.ToUser(users[i], ctx.IsSigned, ctx.User != nil && ctx.User.IsAdmin)
results[i] = convert.ToUser(users[i], ctx.User)
}
ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
@ -112,7 +112,7 @@ func GetInfo(ctx *context.APIContext) {
return
}
ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.IsSigned, ctx.User != nil && (ctx.User.ID == u.ID || ctx.User.IsAdmin)))
ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.User))
}
// GetAuthenticatedUser get current user's information
@ -126,7 +126,7 @@ func GetAuthenticatedUser(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/User"
ctx.JSON(http.StatusOK, convert.ToUser(ctx.User, ctx.IsSigned, ctx.User != nil))
ctx.JSON(http.StatusOK, convert.ToUser(ctx.User, ctx.User))
}
// GetUserHeatmapData is the handler to get a users heatmap