Skip to content

armgit / ente

Public Imported from GitHub
0

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

[server] Return correct value for enableJoin flag

Neeraj Guptac16289fca914
diff --git a/server/ente/public_collection.go b/server/ente/public_collection.go
index 7a477c4365..78b7190784 100644
--- a/server/ente/public_collection.go
+++ b/server/ente/public_collection.go
@@ -3,6 +3,7 @@ package ente
import (
"database/sql/driver"
"encoding/json"
+
"github.com/ente-io/museum/pkg/utils/time"
"github.com/ente-io/stacktrace"
)
@@ -85,7 +86,7 @@ type PublicURL struct {
Nonce *string `json:"nonce,omitempty"`
MemLimit *int64 `json:"memLimit,omitempty"`
OpsLimit *int64 `json:"opsLimit,omitempty"`
- EnableJoin bool `json:"enableJoinViaLink"`
+ EnableJoin bool `json:"enableJoin"`
}
type PublicAccessContext struct {
diff --git a/server/pkg/controller/public_collection.go b/server/pkg/controller/public_collection.go
index d9b5e29b77..022a08812e 100644
--- a/server/pkg/controller/public_collection.go
+++ b/server/pkg/controller/public_collection.go
@@ -331,6 +331,7 @@ func (c *PublicCollectionController) GetPublicCollection(ctx *gin.Context, mustA
Nonce: publicUrl.Nonce,
MemLimit: publicUrl.MemLimit,
OpsLimit: publicUrl.OpsLimit,
+ EnableJoin: publicUrl.EnableJoin,
})
}
collection.PublicURLs = publicURLsWithLimitedInfo
diff --git a/server/pkg/repo/public_collection.go b/server/pkg/repo/public_collection.go
index 49918f4c88..f5ae8f2d72 100644
--- a/server/pkg/repo/public_collection.go
+++ b/server/pkg/repo/public_collection.go
@@ -60,7 +60,7 @@ func (pcr *PublicCollectionRepository) DisableSharing(ctx context.Context, cID i
// GetCollectionToActivePublicURLMap will return map of collectionID to PublicURLs which are not disabled yet.
// Note: The url could be expired or deviceLimit is already reached
func (pcr *PublicCollectionRepository) GetCollectionToActivePublicURLMap(ctx context.Context, collectionIDs []int64) (map[int64][]ente.PublicURL, error) {
- rows, err := pcr.DB.QueryContext(ctx, `SELECT collection_id, access_token, valid_till, device_limit, enable_download, enable_collect, pw_nonce, mem_limit, ops_limit FROM
+ rows, err := pcr.DB.QueryContext(ctx, `SELECT collection_id, access_token, valid_till, device_limit, enable_download, enable_collect, enable_join, pw_nonce, mem_limit, ops_limit FROM
public_collection_tokens WHERE collection_id = ANY($1) and is_disabled = FALSE`,
pq.Array(collectionIDs))
if err != nil {
@@ -77,7 +77,7 @@ func (pcr *PublicCollectionRepository) GetCollectionToActivePublicURLMap(ctx con
var accessToken string
var nonce *string
var opsLimit, memLimit *int64
- if err = rows.Scan(&collectionID, &accessToken, &publicUrl.ValidTill, &publicUrl.DeviceLimit, &publicUrl.EnableDownload, &publicUrl.EnableCollect, &nonce, &memLimit, &opsLimit); err != nil {
+ if err = rows.Scan(&collectionID, &accessToken, &publicUrl.ValidTill, &publicUrl.DeviceLimit, &publicUrl.EnableDownload, &publicUrl.EnableCollect, &publicUrl.EnableJoin, &nonce, &memLimit, &opsLimit); err != nil {
return nil, stacktrace.Propagate(err, "")
}
publicUrl.URL = pcr.GetAlbumUrl(accessToken)