1
0
Fork 0
forked from forgejo/forgejo

Move user follow and openid into models/user/ (#17613)

* Move UserRedirect into models/user/

* Fix lint & test

* Fix lint

* Fix lint

* remove nolint comment

* Fix lint

* Move user follow and openid into models/user

* Ignore the lint

* Ignore the lint

* Fix test

* ignore stutters lint on UserOpenID
This commit is contained in:
Lunny Xiao 2021-11-17 17:58:31 +08:00 committed by GitHub
parent adda27668b
commit 95d3266bee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 155 additions and 143 deletions

View file

@ -9,6 +9,7 @@ import (
"net/http"
"code.gitea.io/gitea/models"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
@ -239,7 +240,7 @@ func Follow(ctx *context.APIContext) {
if ctx.Written() {
return
}
if err := models.FollowUser(ctx.User.ID, target.ID); err != nil {
if err := user_model.FollowUser(ctx.User.ID, target.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "FollowUser", err)
return
}
@ -265,7 +266,7 @@ func Unfollow(ctx *context.APIContext) {
if ctx.Written() {
return
}
if err := models.UnfollowUser(ctx.User.ID, target.ID); err != nil {
if err := user_model.UnfollowUser(ctx.User.ID, target.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "UnfollowUser", err)
return
}