This commit is contained in:
konrad 2018-07-12 22:42:41 +02:00 committed by kolaente
parent 4e503072a8
commit e3b996c383
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
4 changed files with 4 additions and 4 deletions

View file

@ -6,5 +6,5 @@ type CRUDable interface {
ReadOne(int64) error
ReadAll(*User) (interface{}, error)
Update(int64, *User) error
Delete(int64, *User) error
Delete(int64) error
}

View file

@ -1,7 +1,7 @@
package models
// Delete implements the delete method of CRUDable
func (l *List) Delete(id int64, doer *User) (err error) {
func (l *List) Delete(id int64) (err error) {
// Check if the list exists
_, err = GetListByID(id)
if err != nil {

View file

@ -1,7 +1,7 @@
package models
// Delete implements the delete method for listItem
func (i *ListItem) Delete(id int64, doer *User) (err error) {
func (i *ListItem) Delete(id int64) (err error) {
// Check if it exists
_, err = GetListItemByID(id)

View file

@ -23,7 +23,7 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
return echo.NewHTTPError(http.StatusForbidden)
}
err = c.CObject.Delete(id, &user)
err = c.CObject.Delete(id)
if err != nil {
if models.IsErrNeedToBeListAdmin(err) {
return echo.NewHTTPError(http.StatusForbidden, "You need to be the list admin to delete a list.")