diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 617c4104..15086a41 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -28,6 +28,7 @@ Fixed - **Projectroles** - Deprecated ``SODAR_API_*`` settings required in tests (#1495) + - Add workaround to ``ProjectInviteCreateView`` returning 404 with category and query string (#1510) v1.0.2 (2024-09-09) diff --git a/docs/source/major_changes.rst b/docs/source/major_changes.rst index 97fdbd6e..79d57b12 100644 --- a/docs/source/major_changes.rst +++ b/docs/source/major_changes.rst @@ -18,6 +18,7 @@ Release Highlights - Add auth type in user profile details card - Add user count in timeline siteinfo statistics +- Fix invite create view redirect failing in categories - Fix requiring deprecated SODAR API settings in tests diff --git a/projectroles/tests/test_views.py b/projectroles/tests/test_views.py index 5a94f0ea..da5d87de 100644 --- a/projectroles/tests/test_views.py +++ b/projectroles/tests/test_views.py @@ -4118,8 +4118,8 @@ def test_get(self): form.fields['role'].choices, ) - def test_get_from_roleassignment(self): - """Test GET with forwarded values from RoleAssignment Form""" + def test_get_query_string(self): + """Test GET with query string from RoleAssignment form""" data = { 'e': 'test@example.com', 'r': self.role_contributor.pk, @@ -4140,6 +4140,26 @@ def test_get_from_roleassignment(self): ) self.assertEqual(form.fields['email'].initial, 'test@example.com') + def test_get_query_string_category(self): + """Test GET with query string in category""" + category = self.make_project( + 'TestCategory', PROJECT_TYPE_CATEGORY, None + ) + self.make_assignment(category, self.user, self.role_owner) + data = { + 'e': 'test@example.com', + 'r': self.role_contributor.pk, + } + with self.login(self.user): + response = self.client.get( + reverse( + 'projectroles:invite_create', + kwargs={'project': category.sodar_uuid}, + ), + data, + ) + self.assertEqual(response.status_code, 200) + def test_get_not_found(self): """Test GET with invalid project UUID""" with self.login(self.user): diff --git a/projectroles/urls.py b/projectroles/urls.py index 407f109d..18d27dc1 100644 --- a/projectroles/urls.py +++ b/projectroles/urls.py @@ -89,6 +89,12 @@ view=views.ProjectInviteCreateView.as_view(), name='invite_create', ), + # Workaround for issue #1510 + path( + route='invites/create/?e=&r=', + view=views.ProjectInviteCreateView.as_view(), + name='invite_create', + ), path( route='invites/accept/', view=views.ProjectInviteAcceptView.as_view(),