mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 20:02:36 +02:00
fix: show private/draft maps in team maps for members (#2373)
This commit is contained in:
commit
1be00ed8ca
2 changed files with 11 additions and 4 deletions
|
@ -15,9 +15,12 @@ def test_can_see_team_maps(client, map, team):
|
||||||
assert map.name in response.content.decode()
|
assert map.name in response.content.decode()
|
||||||
|
|
||||||
|
|
||||||
def test_others_cannot_see_team_private_maps_in_team_page(client, map, team, user):
|
@pytest.mark.parametrize("share_status", [Map.PRIVATE, Map.DRAFT])
|
||||||
|
def test_others_cannot_see_team_private_maps_in_team_page(
|
||||||
|
client, map, team, user, share_status
|
||||||
|
):
|
||||||
map.team = team
|
map.team = team
|
||||||
map.share_status = Map.PRIVATE
|
map.share_status = share_status
|
||||||
map.save()
|
map.save()
|
||||||
url = reverse("team_maps", args=(team.pk,))
|
url = reverse("team_maps", args=(team.pk,))
|
||||||
response = client.get(url)
|
response = client.get(url)
|
||||||
|
@ -43,7 +46,7 @@ def test_members_can_see_private_maps_in_team_page(
|
||||||
client.login(username=user.username, password="123123")
|
client.login(username=user.username, password="123123")
|
||||||
response = client.get(url)
|
response = client.get(url)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert map.name not in response.content.decode()
|
assert map.name in response.content.decode()
|
||||||
|
|
||||||
|
|
||||||
def test_user_can_see_their_teams(client, team, user):
|
def test_user_can_see_their_teams(client, team, user):
|
||||||
|
|
|
@ -317,7 +317,11 @@ class TeamMaps(PaginatorMixin, DetailView):
|
||||||
context_object_name = "current_team"
|
context_object_name = "current_team"
|
||||||
|
|
||||||
def get_maps(self):
|
def get_maps(self):
|
||||||
return Map.public.filter(team=self.object).order_by("-modified_at")
|
qs = Map.public
|
||||||
|
user = self.request.user
|
||||||
|
if user.is_authenticated and user in self.object.users.all():
|
||||||
|
qs = Map.objects
|
||||||
|
return qs.filter(team=self.object).order_by("-modified_at")
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs.update(
|
kwargs.update(
|
||||||
|
|
Loading…
Reference in a new issue