1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-20 13:29:37 +02:00

Sharing modal fixes and redact email for privacy

This commit is contained in:
Sean Morley 2024-09-10 09:59:59 -04:00
parent 4c858ab8b5
commit 3a2f095ab6
2 changed files with 11 additions and 0 deletions

View file

@ -60,6 +60,9 @@ class PublicUserListView(APIView):
) )
def get(self, request): def get(self, request):
users = User.objects.filter(public_profile=True).exclude(id=request.user.id) users = User.objects.filter(public_profile=True).exclude(id=request.user.id)
# remove the email addresses from the response
for user in users:
user.email = None
serializer = PublicUserSerializer(users, many=True) serializer = PublicUserSerializer(users, many=True)
return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.data, status=status.HTTP_200_OK)
@ -76,5 +79,7 @@ class PublicUserDetailView(APIView):
) )
def get(self, request, user_id): def get(self, request, user_id):
user = get_object_or_404(User, uuid=user_id, public_profile=True) user = get_object_or_404(User, uuid=user_id, public_profile=True)
# remove the email address from the response
user.email = None
serializer = PublicUserSerializer(user) serializer = PublicUserSerializer(user)
return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.data, status=status.HTTP_200_OK)

View file

@ -91,6 +91,9 @@
/> />
</div> </div>
{/each} {/each}
{#if sharedWithUsers.length === 0}
<p class="text-neutral-content">No users shared with</p>
{/if}
</ul> </ul>
<div class="divider"></div> <div class="divider"></div>
<h3 class="font-bold text-md">Not Shared With</h3> <h3 class="font-bold text-md">Not Shared With</h3>
@ -106,6 +109,9 @@
/> />
</div> </div>
{/each} {/each}
{#if notSharedWithUsers.length === 0}
<p class="text-neutral-content">No users not shared with</p>
{/if}
</ul> </ul>
<button class="btn btn-primary mt-4" on:click={close}>Close</button> <button class="btn btn-primary mt-4" on:click={close}>Close</button>
</div> </div>