mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 20:07:05 +03:00
Fix merge not deleting deleted scene generated files (#4567)
This commit is contained in:
@@ -14,7 +14,13 @@ import (
|
||||
"github.com/stashapp/stash/pkg/txn"
|
||||
)
|
||||
|
||||
func (s *Service) Merge(ctx context.Context, sourceIDs []int, destinationID int, scenePartial models.ScenePartial) error {
|
||||
func (s *Service) Merge(
|
||||
ctx context.Context,
|
||||
sourceIDs []int,
|
||||
destinationID int,
|
||||
scenePartial models.ScenePartial,
|
||||
fileDeleter *FileDeleter,
|
||||
) error {
|
||||
// ensure source ids are unique
|
||||
sourceIDs = sliceutil.AppendUniques(nil, sourceIDs)
|
||||
|
||||
@@ -36,8 +42,6 @@ func (s *Service) Merge(ctx context.Context, sourceIDs []int, destinationID int,
|
||||
var fileIDs []models.FileID
|
||||
|
||||
for _, src := range sources {
|
||||
// TODO - delete generated files as needed
|
||||
|
||||
if err := src.LoadRelationships(ctx, s.Repository); err != nil {
|
||||
return fmt.Errorf("loading scene relationships from %d: %w", src.ID, err)
|
||||
}
|
||||
@@ -71,9 +75,11 @@ func (s *Service) Merge(ctx context.Context, sourceIDs []int, destinationID int,
|
||||
}
|
||||
|
||||
// delete old scenes
|
||||
for _, srcID := range sourceIDs {
|
||||
if err := s.Repository.Destroy(ctx, srcID); err != nil {
|
||||
return fmt.Errorf("deleting scene %d: %w", srcID, err)
|
||||
for _, src := range sources {
|
||||
const deleteGenerated = true
|
||||
const deleteFile = false
|
||||
if err := s.Destroy(ctx, src, fileDeleter, deleteGenerated, deleteFile); err != nil {
|
||||
return fmt.Errorf("deleting scene %d: %w", src.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user