Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
a1012112796 2021-03-23 03:15:44 +08:00 committed by GitHub
parent 2f09e5775f
commit a6290f603f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -13,6 +13,10 @@ import (
// ToUser convert models.User to api.User
// signed shall only be set if requester is logged in. authed shall only be set if user is site admin or user himself
func ToUser(user *models.User, signed, authed bool) *api.User {
if user == nil {
return nil
}
result := &api.User{
ID: user.ID,
UserName: user.Name,