fix: lint errors
This commit is contained in:
parent
017f771783
commit
ebc3dd2b3e
@ -89,6 +89,8 @@ issues:
|
|||||||
- path: pkg/models/favorites\.go
|
- path: pkg/models/favorites\.go
|
||||||
linters:
|
linters:
|
||||||
- nilerr
|
- nilerr
|
||||||
|
- path: pkg/models/prject\.go
|
||||||
|
text: "string `parent_project_id` has 3 occurrences, make it a constant"
|
||||||
- path: pkg/models/events\.go
|
- path: pkg/models/events\.go
|
||||||
linters:
|
linters:
|
||||||
- musttag
|
- musttag
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
package migration
|
package migration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"src.techknowlogick.com/xormigrate"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"src.techknowlogick.com/xormigrate"
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
"xorm.io/xorm/schemas"
|
"xorm.io/xorm/schemas"
|
||||||
)
|
)
|
||||||
|
@ -62,7 +62,7 @@ func ExportUserData(s *xorm.Session, u *user.User) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Task attachment files
|
// Task attachment files
|
||||||
err = exportTaskAttachments(s, u, dumpWriter, taskIDs)
|
err = exportTaskAttachments(s, dumpWriter, taskIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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)
|
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)
|
tas, err := getTaskAttachmentsByTaskIDs(s, taskIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"code.vikunja.io/api/pkg/user"
|
"code.vikunja.io/api/pkg/user"
|
||||||
"code.vikunja.io/web"
|
"code.vikunja.io/web"
|
||||||
"xorm.io/builder"
|
"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)
|
canUpdate, err = p.CanWrite(s, a)
|
||||||
// If the project is archived and the user tries to un-archive it, let the request through
|
// 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 {
|
if is && !p.IsArchived && archivedErr.ProjectID == p.ID {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ func getSubscribersForEntity(s *xorm.Session, entityType SubscriptionEntityType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
userIDs := []int64{}
|
userIDs := []int64{}
|
||||||
subscriptions = make([]*Subscription, len(subs))
|
subscriptions = make([]*Subscription, 0, len(subs))
|
||||||
for _, subss := range subs {
|
for _, subss := range subs {
|
||||||
for _, subscription := range subss {
|
for _, subscription := range subss {
|
||||||
userIDs = append(userIDs, subscription.UserID)
|
userIDs = append(userIDs, subscription.UserID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user