Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix bug & use constants

Neeraj Gupta738cd7842a57
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go
index 1443f53f1e..4e6b27359c 100644
--- a/server/cmd/museum/main.go
+++ b/server/cmd/museum/main.go
@@ -187,6 +187,9 @@ func main() {
collectionRepo := &repo.CollectionRepository{DB: db, FileRepo: fileRepo, CollectionLinkRepo: collectionLinkRepo,
TrashRepo: trashRepo, SecretEncryptionKey: secretEncryptionKeyBytes, QueueRepo: queueRepo, LatencyLogger: latencyLogger}
pushRepo := &repo.PushTokenRepository{DB: db}
+ collectionActionRepo := &repo.CollectionActionsRepository{
+ DB: db,
+ }
embeddingRepo := &embedding.Repository{DB: db}
@@ -326,12 +329,12 @@ func main() {
BillingCtrl: billingController,
QueueRepo: queueRepo,
TaskRepo: taskLockingRepo,
- CollectionActionsRepo: &repo.CollectionActionsRepository{DB: db},
+ CollectionActionsRepo: collectionActionRepo,
}
// Pending actions' controller/handler
collectionActionsController := &controller.CollectionActionsController{
- Repo: &repo.CollectionActionsRepository{DB: db},
+ Repo: collectionActionRepo,
}
collectionActionsHandler := &api.CollectionActionsHandler{
Controller: collectionActionsController,
diff --git a/server/pkg/controller/collections/cast.go b/server/pkg/controller/collections/cast.go
index d02f99bd34..1c8525e278 100644
--- a/server/pkg/controller/collections/cast.go
+++ b/server/pkg/controller/collections/cast.go
@@ -34,19 +34,19 @@ func (c *CollectionController) GetCastDiff(ctx *gin.Context, sinceTime int64) ([
if err != nil {
return nil, false, stacktrace.Propagate(err, "")
}
- // hide private metadata before returning files info in diff
- for idx := range diff {
- if diff[idx].MagicMetadata != nil {
- diff[idx].MagicMetadata = nil
- }
- // For cast diffs, treat action markers as deleted and strip action details
- if diff[idx].Action != nil && !diff[idx].IsDeleted {
- if *diff[idx].Action == "REMOVE" || *diff[idx].Action == "DELETE" || *diff[idx].Action == "DELETE_SUGGESTED" {
- diff[idx].IsDeleted = true
- }
- }
- diff[idx].Action = nil
- diff[idx].ActionUserID = nil
- }
+ // hide private metadata before returning files info in diff
+ for idx := range diff {
+ if diff[idx].MagicMetadata != nil {
+ diff[idx].MagicMetadata = nil
+ }
+ // For cast diffs, treat action markers as deleted and strip action details
+ if diff[idx].Action != nil && !diff[idx].IsDeleted {
+ if *diff[idx].Action == ente.ActionRemove || *diff[idx].Action == ente.ActionDeleteSuggested {
+ diff[idx].IsDeleted = true
+ }
+ }
+ diff[idx].Action = nil
+ diff[idx].ActionUserID = nil
+ }
return diff, hasMore, nil
}
diff --git a/server/pkg/controller/collections/files_diff.go b/server/pkg/controller/collections/files_diff.go
index bdcb32caf0..4d76797433 100644
--- a/server/pkg/controller/collections/files_diff.go
+++ b/server/pkg/controller/collections/files_diff.go
@@ -42,7 +42,6 @@ func (c *CollectionController) GetDiffV2(ctx *gin.Context, cID int64, userID int
}
if diff[idx].OwnerID != userID {
diff[idx].MagicMetadata = nil
- diff[idx].PubicMagicMetadata = nil
diff[idx].Action = nil
diff[idx].ActionUserID = nil
}
diff --git a/server/pkg/controller/collections/share.go b/server/pkg/controller/collections/share.go
index 9dae3742d2..986b5ba0c6 100644
--- a/server/pkg/controller/collections/share.go
+++ b/server/pkg/controller/collections/share.go
@@ -5,6 +5,8 @@ import (
"database/sql"
"errors"
"fmt"
+ "strings"
+
"github.com/ente-io/museum/ente"
"github.com/ente-io/museum/pkg/controller/access"
"github.com/ente-io/museum/pkg/utils/array"
@@ -14,7 +16,6 @@ import (
"github.com/gin-contrib/requestid"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
- "strings"
)
func (c *CollectionController) Share(ctx *gin.Context, req ente.AlterShareRequest) ([]ente.CollectionUser, error) {
@@ -287,19 +288,19 @@ func (c *CollectionController) GetPublicDiff(ctx *gin.Context, sinceTime int64)
if err != nil {
return nil, false, stacktrace.Propagate(err, "")
}
- // hide private metadata before returning files info in diff
- for idx := range diff {
- if diff[idx].MagicMetadata != nil {
- diff[idx].MagicMetadata = nil
- }
- // For public diffs, treat action markers as deleted and strip action details
- if diff[idx].Action != nil && !diff[idx].IsDeleted {
- if *diff[idx].Action == "REMOVE" || *diff[idx].Action == "DELETE" || *diff[idx].Action == "DELETE_SUGGESTED" {
- diff[idx].IsDeleted = true
- }
- }
- diff[idx].Action = nil
- diff[idx].ActionUserID = nil
- }
+ // hide private metadata before returning files info in diff
+ for idx := range diff {
+ if diff[idx].MagicMetadata != nil {
+ diff[idx].MagicMetadata = nil
+ }
+ // For public diffs, treat action markers as deleted and strip action details
+ if diff[idx].Action != nil && !diff[idx].IsDeleted {
+ if *diff[idx].Action == ente.ActionRemove || *diff[idx].Action == ente.ActionDeleteSuggested {
+ diff[idx].IsDeleted = true
+ }
+ }
+ diff[idx].Action = nil
+ diff[idx].ActionUserID = nil
+ }
return diff, hasMore, nil
}