fix: lint errors
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2023-01-13 18:42:31 +01:00
parent dbbc99c581
commit 518bf7ded3
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
5 changed files with 11 additions and 5 deletions

View File

@ -88,3 +88,5 @@ issues:
- path: pkg/models/favorites\.go
linters:
- nilerr
- path: pkg/models/prject\.go
text: "string `parent_project_id` has 3 occurrences, make it a constant"

View File

@ -17,8 +17,9 @@
package migration
import (
"src.techknowlogick.com/xormigrate"
"time"
"src.techknowlogick.com/xormigrate"
"xorm.io/xorm"
"xorm.io/xorm/schemas"
)

View File

@ -62,7 +62,7 @@ func ExportUserData(s *xorm.Session, u *user.User) (err error) {
return err
}
// Task attachment files
err = exportTaskAttachments(s, u, dumpWriter, taskIDs)
err = exportTaskAttachments(s, dumpWriter, taskIDs)
if err != nil {
return err
}
@ -213,7 +213,7 @@ func exportProjectsAndTasks(s *xorm.Session, u *user.User, wr *zip.Writer) (task
return taskIDs, utils.WriteBytesToZip("data.json", data, wr)
}
func exportTaskAttachments(s *xorm.Session, u *user.User, wr *zip.Writer, taskIDs []int64) (err error) {
func exportTaskAttachments(s *xorm.Session, wr *zip.Writer, taskIDs []int64) (err error) {
tas, err := getTaskAttachmentsByTaskIDs(s, taskIDs)
if err != nil {
return err

View File

@ -17,6 +17,8 @@
package models
import (
"errors"
"code.vikunja.io/api/pkg/user"
"code.vikunja.io/web"
"xorm.io/builder"
@ -147,7 +149,8 @@ func (p *Project) CanUpdate(s *xorm.Session, a web.Auth) (canUpdate bool, err er
canUpdate, err = p.CanWrite(s, a)
// If the project is archived and the user tries to un-archive it, let the request through
archivedErr, is := err.(ErrProjectIsArchived)
archivedErr := ErrProjectIsArchived{}
is := errors.As(err, &archivedErr)
if is && !p.IsArchived && archivedErr.ProjectID == p.ID {
err = nil
}

View File

@ -361,7 +361,7 @@ func getSubscribersForEntity(s *xorm.Session, entityType SubscriptionEntityType,
}
userIDs := []int64{}
subscriptions = make([]*Subscription, len(subs))
subscriptions = make([]*Subscription, 0, len(subs))
for _, subss := range subs {
for _, subscription := range subss {
userIDs = append(userIDs, subscription.UserID)