Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions isic/core/templates/core/partials/image_thumb.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

<template x-if="true">
<div x-show="open">
{% block image_modal %}
{% include 'core/partials/image_modal.html' with include_metadata=1 %}
{% endblock %}
{% include 'core/partials/image_modal.html' with include_metadata=include_metadata|default_if_none:1 %}
</div>
</template>
4 changes: 2 additions & 2 deletions isic/studies/templates/studies/partials/study_image.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "core/partials/image.html" %}

{% block image_modal %}
{% include 'core/partials/image_modal.html' with include_metadata=0 %}
{% block thumb %}
{% include 'core/partials/image_thumb.html' with include_metadata=0 %}
{% endblock %}

{% block below_thumb %}
Expand Down
2 changes: 1 addition & 1 deletion isic/studies/templates/studies/study_task_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

<template x-if="true">
<div x-show="open">
{% include 'core/partials/image_modal.html' with image=study_task.image %}
{% include 'core/partials/image_modal.html' with image=study_task.image include_metadata=False %}
</div>
</template>
</div>
Expand Down
33 changes: 33 additions & 0 deletions isic/studies/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.utils import timezone
import pytest

from isic.core.tests.factories import ImageFactory
from isic.factories import UserFactory
from isic.studies.models import Question, Response
from isic.studies.models.question_choice import QuestionChoice
Expand Down Expand Up @@ -141,3 +142,35 @@ def test_multiselect_question_empty_response(staff_client) -> None:
lines = r.content.decode().splitlines()
assert len(lines) == 2
assert lines[1].endswith(",")


@pytest.mark.django_db
def test_study_detail_hides_image_metadata(client):
image = ImageFactory.create(public=False, accession__sex="male")
study = StudyFactory.create(public=True)
study.collection.images.add(image)
study_task = StudyTaskFactory.create(study=study, image=image)

client.force_login(study_task.annotator)

r = client.get(reverse("study-detail", args=[study.pk]))
assert r.status_code == 200
content = r.content.decode()

assert "male" not in content


@pytest.mark.django_db
def test_study_task_detail_hides_image_metadata(client):
image = ImageFactory.create(public=False, accession__sex="male")
study = StudyFactory.create(public=True)
study.collection.images.add(image)
study_task = StudyTaskFactory.create(study=study, image=image)

client.force_login(study_task.annotator)

r = client.get(reverse("study-task-detail", args=[study_task.pk]))
assert r.status_code == 200
content = r.content.decode()

assert "male" not in content