-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add creator field to document and allow filtering #429
Merged
AntoLC
merged 10 commits into
main
from
add-created-by-field-to-document-and-allow-filtering
Nov 28, 2024
Merged
Add creator field to document and allow filtering #429
AntoLC
merged 10 commits into
main
from
add-created-by-field-to-document-and-allow-filtering
Nov 28, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sampaccoud
added
python
Pull requests that update Python code
feature
backend
urgent
labels
Nov 18, 2024
AntoLC
reviewed
Nov 18, 2024
src/backend/core/migrations/0011_populate_creator_field_and_make_it_required.py
Show resolved
Hide resolved
qbey
approved these changes
Nov 18, 2024
src/backend/core/migrations/0011_populate_creator_field_and_make_it_required.py
Show resolved
Hide resolved
Closed
sampaccoud
changed the title
Add created by field to document and allow filtering
Add creator field to document and allow filtering
Nov 19, 2024
sampaccoud
force-pushed
the
add-created-by-field-to-document-and-allow-filtering
branch
from
November 25, 2024 16:14
c71a9b7
to
1e1fce5
Compare
AntoLC
force-pushed
the
add-created-by-field-to-document-and-allow-filtering
branch
from
November 28, 2024 11:21
1e1fce5
to
3e7e084
Compare
I realized most of the database queries made when getting a document list view were to include nested accesses. This detailed information about accesses in only necessary for the document detail view. I introduced a specific serializer for the document list view with less fields. For a list of 20 documents with 5 accesses, we go down from 3x5x20= 300 queries to just 3 queries.
A user can now mark/unmark documents as favorite. This is done via a new action of the document API endpoint: /api/v1.0/documents/{document_id}/favorite POST to mark as favorite / DELETE to unmark
The new UI will display the number of accesses on each document. /!\ Once team accesses will be used, this will not represent the number of people with access anymore and will have to be improved by computing the number of people in each team.
On the user search API by similarity, we had a flaky test because 2 users had the same similarity score. Adding a secondary ordering field makes ordering deterministic between users who share the same similarity score.
We want to be able to limit the documents displayed on a logged-in user's list view by the documents they created or by the documents that other users created. This is different from having the "owner" role on a document because this can be acquired and even lost. What we want here is to be able to identify documents by the user who created them so we add a new field.
We recently allowed authenticated users to mark a document as favorite. We were lacking the possibility for users to see only the documents they marked as favorite.
We want to be able to limit document list views to only public documents, or only restricted or authenticated documents.
This is the minimal and fast search feature, while we are working on a full text search based on opensearch. For the moment we only search on the title of the document.
We want to make sure that applying filters on the document view list does not interfere with permissions.
We don't get the accesses anymore from the backeend, instead we get the number of accesses. We remove the list of owners in the doc header because we don't have easily this informations anymore and we will have to do a bigger refacto.
AntoLC
force-pushed
the
add-created-by-field-to-document-and-allow-filtering
branch
from
November 28, 2024 14:34
3e7e084
to
ac9d23d
Compare
AntoLC
deleted the
add-created-by-field-to-document-and-allow-filtering
branch
November 28, 2024 15:02
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
We are currently working on version 2 of Docs' UI. The new UI requires more filters on the documents API endpoint.
In particular, we want to be able to limit the documents displayed on a logged-in user's list view by the documents they created or by the documents that other users created. This is different from having the "owner" role on a document because this can be acquired and even lost. What we want here is to be able to identify documents by the user who created them so we had to add a new field.
Proposal
Add all filters required for the new UI and corresponding tests:
While working on this PR, I identified a flaky test and a db query optimization that I fixed: