Skip to content

Commit

Permalink
fix ProjectInviteCreateView redirect in category (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Nov 4, 2024
1 parent f5be1cc commit a477efb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Fixed

- **Projectroles**
- Deprecated ``SODAR_API_*`` settings required in tests (#1495)
- ``ProjectInviteCreateView`` returning 404 with category and query string (#1510)


v1.0.2 (2024-09-09)
Expand Down
1 change: 1 addition & 0 deletions docs/source/major_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
24 changes: 22 additions & 2 deletions projectroles/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': '[email protected]',
'r': self.role_contributor.pk,
Expand All @@ -4140,6 +4140,26 @@ def test_get_from_roleassignment(self):
)
self.assertEqual(form.fields['email'].initial, '[email protected]')

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': '[email protected]',
'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):
Expand Down
6 changes: 6 additions & 0 deletions projectroles/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
view=views.ProjectInviteCreateView.as_view(),
name='invite_create',
),
# Fix for #1510
path(
route='invites/create/<uuid:project>?e=<str:email>&r=<int:role>',
view=views.ProjectInviteCreateView.as_view(),
name='invite_create',
),
path(
route='invites/accept/<str:secret>',
view=views.ProjectInviteAcceptView.as_view(),
Expand Down

0 comments on commit a477efb

Please sign in to comment.