mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
fix: show private/draft maps in team maps for members
This commit is contained in:
parent
05c27aed98
commit
8a38dd63c9
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()
|
||||
|
||||
|
||||
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.share_status = Map.PRIVATE
|
||||
map.share_status = share_status
|
||||
map.save()
|
||||
url = reverse("team_maps", args=(team.pk,))
|
||||
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")
|
||||
response = client.get(url)
|
||||
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):
|
||||
|
|
|
@ -317,7 +317,11 @@ class TeamMaps(PaginatorMixin, DetailView):
|
|||
context_object_name = "current_team"
|
||||
|
||||
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):
|
||||
kwargs.update(
|
||||
|
|
Loading…
Reference in a new issue