From ce0bff8d9cb9fea1450801b3faae55c54c34c416 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 25 Dec 2018 15:30:11 +0100 Subject: [PATCH] Fixed a bug where updating a list would update it with the same values it had before --- pkg/models/list_create_update.go | 4 ++-- pkg/models/list_rights.go | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/pkg/models/list_create_update.go b/pkg/models/list_create_update.go index 75e90150d87..c2c6f37d3b0 100644 --- a/pkg/models/list_create_update.go +++ b/pkg/models/list_create_update.go @@ -69,10 +69,10 @@ func CreateOrUpdateList(list *List) (err error) { // @Router /lists/{id} [post] func (l *List) Update() (err error) { // Check if it exists - if err = l.GetSimpleByID(); err != nil { + lorig := List{ID: l.ID} + if err = lorig.GetSimpleByID(); err != nil { return } - return CreateOrUpdateList(l) } diff --git a/pkg/models/list_rights.go b/pkg/models/list_rights.go index 77275213700..7bc4f92f4fc 100644 --- a/pkg/models/list_rights.go +++ b/pkg/models/list_rights.go @@ -75,22 +75,12 @@ func (l *List) CanRead(a web.Auth) bool { // CanDelete checks if the user can delete a list func (l *List) CanDelete(a web.Auth) bool { doer := getUserForRights(a) - - if err := l.GetSimpleByID(); err != nil { - log.Log.Error("Error occurred during CanDelete for List: %s", err) - return false - } return l.IsAdmin(doer) } // CanUpdate checks if the user can update a list func (l *List) CanUpdate(a web.Auth) bool { doer := getUserForRights(a) - - if err := l.GetSimpleByID(); err != nil { - log.Log.Error("Error occurred during CanUpdate for List: %s", err) - return false - } return l.CanWrite(doer) }