Fixed a bug where updating a list would update it with the same values it had before
All checks were successful
the build was successful
All checks were successful
the build was successful
This commit is contained in:
parent
5a93475be9
commit
ce0bff8d9c
|
@ -69,10 +69,10 @@ func CreateOrUpdateList(list *List) (err error) {
|
||||||
// @Router /lists/{id} [post]
|
// @Router /lists/{id} [post]
|
||||||
func (l *List) Update() (err error) {
|
func (l *List) Update() (err error) {
|
||||||
// Check if it exists
|
// Check if it exists
|
||||||
if err = l.GetSimpleByID(); err != nil {
|
lorig := List{ID: l.ID}
|
||||||
|
if err = lorig.GetSimpleByID(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return CreateOrUpdateList(l)
|
return CreateOrUpdateList(l)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,22 +75,12 @@ func (l *List) CanRead(a web.Auth) bool {
|
||||||
// CanDelete checks if the user can delete a list
|
// CanDelete checks if the user can delete a list
|
||||||
func (l *List) CanDelete(a web.Auth) bool {
|
func (l *List) CanDelete(a web.Auth) bool {
|
||||||
doer := getUserForRights(a)
|
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)
|
return l.IsAdmin(doer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanUpdate checks if the user can update a list
|
// CanUpdate checks if the user can update a list
|
||||||
func (l *List) CanUpdate(a web.Auth) bool {
|
func (l *List) CanUpdate(a web.Auth) bool {
|
||||||
doer := getUserForRights(a)
|
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)
|
return l.CanWrite(doer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user