diff --git a/backend/server/adventures/serializers.py b/backend/server/adventures/serializers.py index 4985d2d..3023e04 100644 --- a/backend/server/adventures/serializers.py +++ b/backend/server/adventures/serializers.py @@ -209,8 +209,6 @@ class AdventureSerializer(CustomModelSerializer): category_data = validated_data.pop('category', None) collections_data = validated_data.pop('collections', None) - collections_add = validated_data.pop('collections_add', []) - collections_remove = validated_data.pop('collections_remove', []) # Update regular fields for attr, value in validated_data.items(): diff --git a/backend/server/adventures/views/collection_view.py b/backend/server/adventures/views/collection_view.py index fca9986..40ebbd6 100644 --- a/backend/server/adventures/views/collection_view.py +++ b/backend/server/adventures/views/collection_view.py @@ -55,7 +55,7 @@ class CollectionViewSet(viewsets.ModelViewSet): # make sure the user is authenticated if not request.user.is_authenticated: return Response({"error": "User is not authenticated"}, status=400) - queryset = Collection.objects.filter(user_id=request.user.id) + queryset = Collection.objects.filter(user_id=request.user.id, is_archived=False) queryset = self.apply_sorting(queryset) collections = self.paginate_and_respond(queryset, request) return collections @@ -226,7 +226,6 @@ class CollectionViewSet(viewsets.ModelViewSet): (Q(user_id=self.request.user.id) | Q(shared_with=self.request.user)) & Q(is_archived=False) ).distinct() - def perform_create(self, serializer): # This is ok because you cannot share a collection when creating it serializer.save(user_id=self.request.user) diff --git a/frontend/src/lib/components/AdventureModal.svelte b/frontend/src/lib/components/AdventureModal.svelte index e8b7d6e..4c2e07a 100644 --- a/frontend/src/lib/components/AdventureModal.svelte +++ b/frontend/src/lib/components/AdventureModal.svelte @@ -112,7 +112,6 @@ location: null, images: [], user_id: null, - collection: collection?.id || null, category: { id: '', name: '', @@ -138,7 +137,6 @@ location: adventureToEdit?.location || null, images: adventureToEdit?.images || [], user_id: adventureToEdit?.user_id || null, - collection: adventureToEdit?.collection || collection?.id || null, visits: adventureToEdit?.visits || [], is_visited: adventureToEdit?.is_visited || false, category: adventureToEdit?.category || { @@ -628,7 +626,7 @@

{wikiError}

- {#if !adventure?.collection} + {#if adventure.collections && adventure.collections.length == 0}
{/if}
diff --git a/frontend/src/lib/components/CollectionModal.svelte b/frontend/src/lib/components/CollectionModal.svelte index 93ec776..dfcc88d 100644 --- a/frontend/src/lib/components/CollectionModal.svelte +++ b/frontend/src/lib/components/CollectionModal.svelte @@ -219,6 +219,28 @@ {$t('about.close')} + + {#if collection.is_public && collection.id} +
+

{$t('adventures.share_collection')}

+
+

+ {window.location.origin}/collections/{collection.id} +

+ +
+
+ {/if} diff --git a/frontend/src/lib/components/Navbar.svelte b/frontend/src/lib/components/Navbar.svelte index f655454..4f3ad9a 100644 --- a/frontend/src/lib/components/Navbar.svelte +++ b/frontend/src/lib/components/Navbar.svelte @@ -277,7 +277,7 @@ {#if data.user} {/if} -