Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Disable all links on account deletion

Neeraj Guptac57d4679656b
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go
index 17c7b5ba42..9b22620181 100644
--- a/server/cmd/museum/main.go
+++ b/server/cmd/museum/main.go
@@ -308,6 +308,7 @@ func main() {
FileController: fileController,
EmailNotificationCtrl: emailNotificationCtrl,
CollectionLinkRepo: collectionLinkRepo,
+ FileLinkRepo: fileLinkRepo,
CollectionRepo: collectionRepo,
UserRepo: userRepo,
JwtSecret: jwtSecretBytes,
diff --git a/server/pkg/controller/public/collection_link.go b/server/pkg/controller/public/collection_link.go
index 52ca2d7689..ead744bfbf 100644
--- a/server/pkg/controller/public/collection_link.go
+++ b/server/pkg/controller/public/collection_link.go
@@ -54,6 +54,7 @@ type CollectionLinkController struct {
FileController *controller.FileController
EmailNotificationCtrl *emailCtrl.EmailNotificationController
CollectionLinkRepo *public.CollectionLinkRepo
+ FileLinkRepo *public.FileLinkRepository
CollectionRepo *repo.CollectionRepository
UserRepo *repo.UserRepository
JwtSecret []byte
@@ -270,7 +271,7 @@ func (c *CollectionLinkController) HandleAccountDeletion(ctx context.Context, us
return stacktrace.Propagate(err, "")
}
}
- return nil
+ return c.FileLinkRepo.DisableLinksForUser(ctx, userID)
}
// GetPublicCollection will return collection info for a public url.
diff --git a/server/pkg/repo/public/file_link.go b/server/pkg/repo/public/file_link.go
index c03b74c693..beaeda2e74 100644
--- a/server/pkg/repo/public/file_link.go
+++ b/server/pkg/repo/public/file_link.go
@@ -124,8 +124,8 @@ func (pcr *FileLinkRepository) DisableLinkForFiles(ctx context.Context, fileIDs
}
// DisableLinksForUser will disable all public file links for the given user
-func (pcr *FileLinkRepository) DisableLinksForUser(ctx context.Context, linkID string) error {
- _, err := pcr.DB.ExecContext(ctx, `UPDATE public_file_tokens SET is_disabled = TRUE WHERE id = $1`, linkID)
+func (pcr *FileLinkRepository) DisableLinksForUser(ctx context.Context, userID int64) error {
+ _, err := pcr.DB.ExecContext(ctx, `UPDATE public_file_tokens SET is_disabled = TRUE WHERE owner_id = $1`, userID)
if err != nil {
return stacktrace.Propagate(err, "failed to disable public file link")
}