Merge branch 'download-all-my-pictures' into 'master'

Fix 'download all my picture button' being displayed in all albums sections

This MR fix the following issue where the download all button is displayed in each album (hence it's for all photos & not only by album)
![image](/uploads/c888e2bf8715d18cd2ea26e63f9fac28/image.png)

See merge request ae-utbm/Sith!320
This commit is contained in:
Antoine Bartuccio 2022-08-09 17:09:48 +00:00
commit 35c120a29f
2 changed files with 5 additions and 3 deletions

View File

@ -6,7 +6,7 @@ from rest_framework.renderers import JSONRenderer
from rest_framework.request import Request
from rest_framework.response import Response
from core.views import can_edit_prop
from core.views import can_edit
from core.models import User
from sas.models import Picture
@ -24,7 +24,7 @@ def all_pictures_of_user(user: User) -> List[Picture]:
@renderer_classes((JSONRenderer,))
def all_pictures_of_user_endpoint(request: Request, user: int):
requested_user: User = get_object_or_404(User, pk=user)
if not can_edit_prop(requested_user, request.user):
if not can_edit(requested_user, request.user):
raise PermissionDenied
return Response(

View File

@ -5,8 +5,10 @@
{% endblock %}
{% block content %}
{% if can_edit(profile, user) %}
<button id="download_all_pictures", onclick=download_pictures()>{% trans %}Download all my pictures{% endtrans %}</button>
{% endif %}
{% for a in albums %}
<button id="download_all_pictures", onclick=download_pictures()>{% trans %}Download all my pictures{% endtrans %}</button>
<div style="padding: 10px">
<h4>{{ a.name }}</h4>
<hr>