[server] Return correct value for enableJoin flag
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user