summaryrefslogtreecommitdiffstats
path: root/modules/convert
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-02-18 09:25:35 +0100
committerGitHub <noreply@github.com>2021-02-18 16:25:35 +0800
commit8d5c795cc4cc6b254a897461a860f25b0708ee14 (patch)
tree691eec6fd0abe6824f84e6eb64f4d2f086918a3a /modules/convert
parentce0346448ff6c8e92f794e7b724f3d4333412a9b (diff)
downloadgitea-8d5c795cc4cc6b254a897461a860f25b0708ee14.tar.gz
gitea-8d5c795cc4cc6b254a897461a860f25b0708ee14.zip
[API] Add Restricted Field to User (#14630)
* Expose Restricted field for User * Add Option to Change Restricted on User via adminEditUser API * Add test who change restricted & test if it changed it ... * make generate-swagger Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/convert')
-rw-r--r--modules/convert/user.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/convert/user.go b/modules/convert/user.go
index 010c92b969..f5d853fd4d 100644
--- a/modules/convert/user.go
+++ b/modules/convert/user.go
@@ -17,12 +17,13 @@ func ToUser(user *models.User, signed, authed bool) *api.User {
return nil
}
result := &api.User{
- ID: user.ID,
- UserName: user.Name,
- FullName: markup.Sanitize(user.FullName),
- Email: user.GetEmail(),
- AvatarURL: user.AvatarLink(),
- Created: user.CreatedUnix.AsTime(),
+ ID: user.ID,
+ UserName: user.Name,
+ FullName: markup.Sanitize(user.FullName),
+ Email: user.GetEmail(),
+ AvatarURL: user.AvatarLink(),
+ Created: user.CreatedUnix.AsTime(),
+ Restricted: user.IsRestricted,
}
// hide primary email if API caller is anonymous or user keep email private
if signed && (!user.KeepEmailPrivate || authed) {