Skip to content

Refactor document content management#2171

Open
lunika wants to merge 4 commits intomainfrom
improvement/content
Open

Refactor document content management#2171
lunika wants to merge 4 commits intomainfrom
improvement/content

Conversation

@lunika
Copy link
Copy Markdown
Member

@lunika lunika commented Apr 3, 2026

Purpose

The document content was always present in the document response; updating a document's properties always loads the content in the response, and updating the content is mixed with the document properties.

We decided to remove this behavior, to make dedicated endpoints for fetching and updating document content. We reuse the same mechanism used to fetch a document attachment.

This PR is introducing many breaking changes. A new major version of Docs must be released after we implement all this changes.

A solution must be found to fetch the content from an external api, for now it is not possible to retrieve the content from the resource server api.

All the mechanisms to determine whether a user can update a document related to the websocket, is not yet implemented. We have to determine if we still need it or not.

Lot of tests must be made before merging it.

Proposal

  • 🔥(backend) remove content in document responses
  • ✨(backend) create a dedicated endpoint to update document content
  • ⚡️(backend) access document content using nginx auth_request module
  • ♻️(backend) rename documents content endpoint in convert
  • solution for the external api
  • Strengthen *-auth endpoints
  • Determine if mechanisms around the websocket is still needed to update a document content and document's properties. (Work related to this PR 🚩(frontend) feature flag on blocking edition #997)

lunika added 4 commits April 3, 2026 13:45
The endpoint /api/v1.0/documents/{document_id}/content has been renamed
in /api/v1.0/documents/{document_id}/convert. Convert seems more
accurante and the content endpoint will be used for another purpose more
appropriated.
Accessing a document content can take time in a single request when
fetching the retieve endpoint. To speed up this part at put less effort
on the django workers, we decided to apply the same mechanism already
used to access a media. A new route content-auth is added, checking the
url used as original url contains a valid uuid the user can access.
We want a dedicated endpoint to update a document content. Previously,
updating the content was made on the update action shared with all other
document's properties. When the title is updated, the response contains
the content, so a call to the s3 storage is made and we don't want this.
Isolating the content update will allow us in the next commit to remove
the content from the Document serializer.
The content was always loaded in the document reponse. We remove this
behavior in order to not make an http call to the s3 storage. To get the
document content it is needed now to use the new endpoint dedicated to
retrive the document content.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dedc4761-af44-4695-bf34-9b7e1a700449

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improvement/content

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant