mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-16 23:12:43 +00:00
Move some files into models' sub packages (#20262)
* Move some files into models' sub packages * Move functions * merge main branch * Fix check * fix check * Fix some tests * Fix lint * Fix lint * Revert lint changes * Fix error comments * Fix lint Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
4a4bfafa23
commit
1d8543e7db
154 changed files with 1763 additions and 1738 deletions
|
@ -8,7 +8,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
activities_model "code.gitea.io/gitea/models/activities"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
|
@ -69,13 +69,13 @@ func ListNotifications(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
totalCount, err := models.CountNotifications(opts)
|
||||
totalCount, err := activities_model.CountNotifications(opts)
|
||||
if err != nil {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
}
|
||||
|
||||
nl, err := models.GetNotifications(ctx, opts)
|
||||
nl, err := activities_model.GetNotifications(ctx, opts)
|
||||
if err != nil {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
|
@ -140,7 +140,7 @@ func ReadNotifications(ctx *context.APIContext) {
|
|||
lastRead = tmpLastRead.Unix()
|
||||
}
|
||||
}
|
||||
opts := &models.FindNotificationOptions{
|
||||
opts := &activities_model.FindNotificationOptions{
|
||||
UserID: ctx.Doer.ID,
|
||||
UpdatedBeforeUnix: lastRead,
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ func ReadNotifications(ctx *context.APIContext) {
|
|||
statuses := ctx.FormStrings("status-types")
|
||||
opts.Status = statusStringsToNotificationStatuses(statuses, []string{"unread"})
|
||||
}
|
||||
nl, err := models.GetNotifications(ctx, opts)
|
||||
nl, err := activities_model.GetNotifications(ctx, opts)
|
||||
if err != nil {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
|
@ -156,13 +156,13 @@ func ReadNotifications(ctx *context.APIContext) {
|
|||
|
||||
targetStatus := statusStringToNotificationStatus(ctx.FormString("to-status"))
|
||||
if targetStatus == 0 {
|
||||
targetStatus = models.NotificationStatusRead
|
||||
targetStatus = activities_model.NotificationStatusRead
|
||||
}
|
||||
|
||||
changed := make([]*structs.NotificationThread, 0, len(nl))
|
||||
|
||||
for _, n := range nl {
|
||||
notif, err := models.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
|
||||
notif, err := activities_model.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
|
||||
if err != nil {
|
||||
ctx.InternalServerError(err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue