diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go index 92e9591cf8..9403efaa5a 100644 --- a/server/cmd/museum/main.go +++ b/server/cmd/museum/main.go @@ -504,7 +504,6 @@ func main() { privateAPI.GET("/collections/v2/diff", collectionHandler.GetDiffV2) privateAPI.GET("/collections/file", collectionHandler.GetFile) privateAPI.GET("/collections/sharees", collectionHandler.GetSharees) - privateAPI.DELETE("/collections/v2/:collectionID", collectionHandler.Trash) privateAPI.DELETE("/collections/v3/:collectionID", collectionHandler.TrashV3) privateAPI.POST("/collections/rename", collectionHandler.Rename) privateAPI.PUT("/collections/magic-metadata", collectionHandler.PrivateMagicMetadataUpdate) diff --git a/server/pkg/api/collection.go b/server/pkg/api/collection.go index fff98e7f43..65c38bc613 100644 --- a/server/pkg/api/collection.go +++ b/server/pkg/api/collection.go @@ -360,18 +360,6 @@ func (h *CollectionHandler) GetSharees(c *gin.Context) { }) } -// Trash deletes a given collection and move file exclusive to the collection to trash -func (h *CollectionHandler) Trash(c *gin.Context) { - cID, _ := strconv.ParseInt(c.Param("collectionID"), 10, 64) - userID := auth.GetUserID(c.Request.Header) - err := h.Controller.Trash(c, userID, cID) - if err != nil { - handler.Error(c, stacktrace.Propagate(err, "")) - return - } - c.Status(http.StatusOK) -} - func (h *CollectionHandler) TrashV3(c *gin.Context) { var req ente.TrashCollectionV3Request if err := c.ShouldBindQuery(&req); err != nil { diff --git a/server/pkg/controller/collection.go b/server/pkg/controller/collection.go index 3969cfd3d8..4deb58db95 100644 --- a/server/pkg/controller/collection.go +++ b/server/pkg/controller/collection.go @@ -619,38 +619,6 @@ func (c *CollectionController) GetSharees(ctx *gin.Context, cID int64, userID in return sharees, nil } -// Trash deletes a given collection and files exclusive to the collection -func (c *CollectionController) Trash(ctx *gin.Context, userID int64, cID int64) error { - resp, err := c.AccessCtrl.GetCollection(ctx, &access.GetCollectionParams{ - CollectionID: cID, - ActorUserID: userID, - IncludeDeleted: true, - VerifyOwner: true, - }) - if err != nil { - return stacktrace.Propagate(err, "") - } - if !resp.Collection.AllowDelete() { - return stacktrace.Propagate(ente.ErrBadRequest, fmt.Sprintf("deleting albums of type %s is not allowed", resp.Collection.Type)) - } - if resp.Collection.IsDeleted { - log.WithFields(log.Fields{ - "c_id": cID, - "user_id": userID, - }).Warning("Collection is already deleted") - return nil - } - err = c.PublicCollectionCtrl.Disable(ctx, cID) - if err != nil { - return stacktrace.Propagate(err, "failed to disabled public share url") - } - err = c.CollectionRepo.ScheduleDelete(cID, true) - if err != nil { - return stacktrace.Propagate(err, "") - } - return nil -} - // TrashV3 deletes a given collection and based on user input (TrashCollectionV3Request.KeepFiles as FALSE) , it will move all files present in the underlying collection // to trash. func (c *CollectionController) TrashV3(ctx *gin.Context, req ente.TrashCollectionV3Request) error {