Fix lint
This commit is contained in:
parent
5443487958
commit
76c72b31de
|
@ -17,8 +17,9 @@
|
|||
package migration
|
||||
|
||||
import (
|
||||
"src.techknowlogick.com/xormigrate"
|
||||
"time"
|
||||
|
||||
"src.techknowlogick.com/xormigrate"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ func (l *List) ReadOne(s *xorm.Session, a web.Auth) (err error) {
|
|||
}
|
||||
|
||||
l.Subscription, err = getSubscription(s, SubscriptionEntityList, l.ID, a)
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
// GetListSimpleByID gets a list with only the basic items, aka no tasks or user objects. Returns an error if the list does not exist.
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"code.vikunja.io/api/pkg/user"
|
||||
"code.vikunja.io/web"
|
||||
"time"
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// CanCreate checks if a user can subscribe to an entity
|
||||
func (sb *Subscription) CanCreate(s *xorm.Session, a web.Auth) (can bool, err error) {
|
||||
if _, is := a.(*LinkSharing); is {
|
||||
return false, &ErrGenericForbidden{}
|
||||
|
@ -45,6 +46,7 @@ func (sb *Subscription) CanCreate(s *xorm.Session, a web.Auth) (can bool, err er
|
|||
return
|
||||
}
|
||||
|
||||
// CanDelete checks if a user can delete a subscription
|
||||
func (sb *Subscription) CanDelete(s *xorm.Session, a web.Auth) (can bool, err error) {
|
||||
if _, is := a.(*LinkSharing); is {
|
||||
return false, &ErrGenericForbidden{}
|
||||
|
@ -59,7 +61,6 @@ func (sb *Subscription) CanDelete(s *xorm.Session, a web.Auth) (can bool, err er
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// TODO: Return a 404 if the subscription does not exist
|
||||
|
||||
return realSb.UserID == a.GetID(), nil
|
||||
}
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.vikunja.io/api/pkg/db"
|
||||
"code.vikunja.io/api/pkg/user"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSubscriptionGetTypeFromString(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue