diff options
author | 6543 <6543@obermui.de> | 2020-10-17 06:23:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-17 00:23:08 -0400 |
commit | d453533beb197d25b25530dc5f0e3c3c0742d8d1 (patch) | |
tree | 6d66e1163333344d91af63e9ab50a82367470b8f /models/user.go | |
parent | 131278ff222f1a8580f20e6bbdff405341403042 (diff) | |
download | gitea-d453533beb197d25b25530dc5f0e3c3c0742d8d1.tar.gz gitea-d453533beb197d25b25530dc5f0e3c3c0742d8d1.zip |
[Refactor] Move APIFormat functions into convert package (#12856)
* USER APIFormat -> ToUser
* Migrate more and mark APIFormat deprecated
* models.Comment APIFormat() -> convert.ToComment
* models.Release APIFormat() -> convert.ToRelease
* models.Attachments APIFormat() -> convert.ToReleaseAttachments
* models.CommitStatus APIFormat() -> convert.ToCommitStatus
* finish migration to convert.ToUser
* Move Test
* Imprufe Test
* fix test
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/models/user.go b/models/user.go index f019475298..2e38502c5b 100644 --- a/models/user.go +++ b/models/user.go @@ -29,7 +29,6 @@ import ( "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/storage" "code.gitea.io/gitea/modules/structs" - api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" @@ -241,24 +240,6 @@ func GetAllUsers() ([]*User, error) { return users, x.OrderBy("id").Find(&users) } -// APIFormat converts a User to api.User -func (u *User) APIFormat() *api.User { - if u == nil { - return nil - } - return &api.User{ - ID: u.ID, - UserName: u.Name, - FullName: u.FullName, - Email: u.GetEmail(), - AvatarURL: u.AvatarLink(), - Language: u.Language, - IsAdmin: u.IsAdmin, - LastLogin: u.LastLoginUnix.AsTime(), - Created: u.CreatedUnix.AsTime(), - } -} - // IsLocal returns true if user login type is LoginPlain. func (u *User) IsLocal() bool { return u.LoginType <= LoginPlain |