aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-18 13:58:42 +0800
committerGitHub <noreply@github.com>2021-11-18 13:58:42 +0800
commit3c3855a05c79ccc7a8495cdbf4a361e7bef74248 (patch)
tree43f8616bca25a09c0e284e9407819ba43a6a0d79 /routers
parent6874fe90e591fa1bfb4b0575b27d876ab544e6e0 (diff)
downloadgitea-3c3855a05c79ccc7a8495cdbf4a361e7bef74248.tar.gz
gitea-3c3855a05c79ccc7a8495cdbf4a361e7bef74248.zip
Move user functions into user.go (#17659)
* Move user functions into user.go * Fix test
Diffstat (limited to 'routers')
-rw-r--r--routers/web/admin/notice.go10
-rw-r--r--routers/web/repo/middlewares.go4
2 files changed, 7 insertions, 7 deletions
diff --git a/routers/web/admin/notice.go b/routers/web/admin/notice.go
index fab3aba533..3613f428ed 100644
--- a/routers/web/admin/notice.go
+++ b/routers/web/admin/notice.go
@@ -9,7 +9,7 @@ import (
"net/http"
"strconv"
- "code.gitea.io/gitea/models"
+ admin_model "code.gitea.io/gitea/models/admin"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
@@ -26,13 +26,13 @@ func Notices(ctx *context.Context) {
ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminNotices"] = true
- total := models.CountNotices()
+ total := admin_model.CountNotices()
page := ctx.FormInt("page")
if page <= 1 {
page = 1
}
- notices, err := models.Notices(page, setting.UI.Admin.NoticePagingNum)
+ notices, err := admin_model.Notices(page, setting.UI.Admin.NoticePagingNum)
if err != nil {
ctx.ServerError("Notices", err)
return
@@ -57,7 +57,7 @@ func DeleteNotices(ctx *context.Context) {
}
}
- if err := models.DeleteNoticesByIDs(ids); err != nil {
+ if err := admin_model.DeleteNoticesByIDs(ids); err != nil {
ctx.Flash.Error("DeleteNoticesByIDs: " + err.Error())
ctx.Status(500)
} else {
@@ -68,7 +68,7 @@ func DeleteNotices(ctx *context.Context) {
// EmptyNotices delete all the notices
func EmptyNotices(ctx *context.Context) {
- if err := models.DeleteNotices(0, 0); err != nil {
+ if err := admin_model.DeleteNotices(0, 0); err != nil {
ctx.ServerError("DeleteNotices", err)
return
}
diff --git a/routers/web/repo/middlewares.go b/routers/web/repo/middlewares.go
index 2505443504..a5d478dd73 100644
--- a/routers/web/repo/middlewares.go
+++ b/routers/web/repo/middlewares.go
@@ -7,7 +7,7 @@ package repo
import (
"fmt"
- "code.gitea.io/gitea/models"
+ admin_model "code.gitea.io/gitea/models/admin"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
)
@@ -23,7 +23,7 @@ func SetEditorconfigIfExists(ctx *context.Context) {
if err != nil && !git.IsErrNotExist(err) {
description := fmt.Sprintf("Error while getting .editorconfig file: %v", err)
- if err := models.CreateRepositoryNotice(description); err != nil {
+ if err := admin_model.CreateRepositoryNotice(description); err != nil {
ctx.ServerError("ErrCreatingReporitoryNotice", err)
}
return