Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to
### Changed

- 鈾匡笍(frontend) use semantic `<dl>` structure in document info card #2379
- 馃殮(global) move favorite documents API endpoint to `/documents/favorites/`

## [v5.4.1] - 2026-07-09

Expand Down
3 changes: 2 additions & 1 deletion src/backend/core/api/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ class DocumentViewSet(
8. **Favorite**: Get list of favorite documents for a user. Mark or unmark
a document as favorite.
Examples:
- GET /documents/favorite_list/
- GET /documents/favorites/
- POST, DELETE /documents/{id}/favorite/

9. **Create for Owner**: Create a document via server-to-server on behalf of a user.
Expand Down Expand Up @@ -836,6 +836,7 @@ def can_edit(self, request, *args, **kwargs):
detail=False,
methods=["get"],
permission_classes=[permissions.IsAuthenticated],
url_path="favorites",
)
def favorite_list(self, request, *args, **kwargs):
"""Get list of favorite documents for the current user."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_api_document_favorite_list_anonymous():
"""Anonymous users should receive a 401 error."""
client = APIClient()

response = client.get("/api/v1.0/documents/favorite_list/")
response = client.get("/api/v1.0/documents/favorites/")

assert response.status_code == 401

Expand All @@ -27,7 +27,7 @@ def test_api_document_favorite_list_authenticated_no_favorite():
client = APIClient()
client.force_login(user)

response = client.get("/api/v1.0/documents/favorite_list/")
response = client.get("/api/v1.0/documents/favorites/")

assert response.status_code == 200
assert response.json() == {
Expand All @@ -53,7 +53,7 @@ def test_api_document_favorite_list_authenticated_with_favorite():
user=user, role=models.RoleChoices.READER, document__favorited_by=[user]
).document

response = client.get("/api/v1.0/documents/favorite_list/")
response = client.get("/api/v1.0/documents/favorites/")

assert response.status_code == 200
assert response.json() == {
Expand Down Expand Up @@ -107,7 +107,7 @@ def test_api_document_favorite_list_with_favorite_children():
other_root = factories.DocumentFactory(creator=user, users=[user])
factories.DocumentFactory.create_batch(2, parent=other_root)

response = client.get("/api/v1.0/documents/favorite_list/")
response = client.get("/api/v1.0/documents/favorites/")

assert response.status_code == 200
assert response.json()["count"] == 3
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_api_document_favorite_list_sorted_by_updated_at():
updated_at=now + timedelta(seconds=3)
)

response = client.get("/api/v1.0/documents/favorite_list/")
response = client.get("/api/v1.0/documents/favorites/")

assert response.status_code == 200
assert response.json()["count"] == 3
Expand All @@ -176,7 +176,7 @@ def test_api_document_favorite_list_with_deleted_child():

child1.delete()

response = client.get("/api/v1.0/documents/favorite_list/")
response = client.get("/api/v1.0/documents/favorites/")

assert response.status_code == 200
assert response.json()["count"] == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_external_api_documents_favorites_list_allowed(
document__favorited_by=[user_specific_sub],
).document

response = client.get("/external_api/v1.0/documents/favorite_list/")
response = client.get("/external_api/v1.0/documents/favorites/")

assert response.status_code == 200
data = response.json()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const getDocsFavorite = async (
}

const response = await fetchAPI(
`documents/favorite_list/?${searchParams.toString()}`,
`documents/favorites/?${searchParams.toString()}`,
);

if (!response.ok) {
Expand Down
Loading