refactor/introduce IContext - #9062
max-nextcloud wants to merge 73 commits into
Conversation
3e17210 to
a2260eb
Compare
ae7bbf6 to
92e1890
Compare
c9d35f7 to
cd2d5b9
Compare
b0a7b15 to
7cedf66
Compare
cd2d5b9 to
c4cca9f
Compare
7cedf66 to
1bb5586
Compare
7232808 to
5907ff4
Compare
1bc577e to
58fe27f
Compare
|
So far I read up to commit What I stumble over is that the IContext file contains the additional classes Maybe this is also OK, just to double check: a call to No biggie: new classes miss the Can consider to mark the new event unstable or experimental, though I am not aware of a phpdoc or internal established annotation. |
|
On my dev instance I get an error during Migration: {
"reqId": "miQrQfvExjkhgL8Z3V6T",
"level": 3,
"time": "2026-08-19T14:14:45+00:00",
"remoteAddr": "",
"user": "--",
"app": "updater",
"method": "",
"url": "--",
"scriptName": "occ",
"message": "\\OC\\Updater::failure: Exception: Database error when running migration 090000Date20260817110024 for app text\nAn exception occurred while executing a query: SQLSTATE[23502]: Not null violation: 7 ERROR: column \"context_type\" of relation \"oc_text_documents\" contains null values",
"userAgent": "--",
"version": "35.0.0.3",
"occ_command": [
"occ",
"upgrade"
],
"data": {
"app": "updater"
}
}DB is postgres. Probably happens because the column is added as UPDATE: same with context_id. Default to 0? |
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
We can detect the conflict afterwards and handle it in the document service. This makes the `updateDocument` function easier to understand and reuse. Signed-off-by: Max <max@nextcloud.com>
If this event is emitted for a context the related document and all connected sessions will be cleared. This will cause the next requests to be answered with 412 responses which in turn cause the client to render a conflict screen. Signed-off-by: Max <max@nextcloud.com>
* Separates the file specific concerns from the generic document concerns. * This makes `DocumentService` independent of `LockService` and `FileService`. Signed-off-by: Max <max@nextcloud.com>
Changing the object and returning it is confusing. Use `$document->getUpdatedFields()` to determine what changed. Signed-off-by: Max <max@nextcloud.com>
Throws the proper exception afterwards. Co-authored-by: Arthur Schiwon <blizzz@arthur-schiwon.de> Signed-off-by: max-nextcloud <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Make it indistinguishable from a missing file. Signed-off-by: Max <max@nextcloud.com>
Also make it work without one instead of throwing exception. Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
When adding an image with the curson in another images alt text `setImage` currently changes the images src and adds the image with the original src below. Handle the changed src attribute of image views gracefully. It's a prop after all - so we should be ready for it to change. Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
d658e32 to
d4871b2
Compare
Do not rely on autoincrement ids, which require shuffling tables around in the migration as some databases cannot change columns to autoincrement. `$document->id` is now a string, which conflicts with the definition in the Entity class. Mute the psalm warning about this for now. Proper solution will be to migrate to the new ORM. https://carlschwan.eu/2026/08/18/modern-stable-apis-for-your-nextcloud-application/ Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
It does not work on all database types. Therefore we will use snowflake ids instead. Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
… fileId Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
We have two ways of identifying the text file: * via the session -> document -> contextId. * directly via the fileId given for example to the MarkdownContentEditor. For the latter to work we need the fileId to be passed to the getAttachmentList action. Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
In some scenarios (MarkdownContentEditor with fileId) there is no session. Thus we need the file id of the markdown file to access the attachments as there may not even be a document record in the database. Get the context inside the AttachmentController using either the session or the fileId and then hand it on to the AttachmentService. When getting the attachment list also adjust the urls to include the fileId when needed. Do not return the documentId in some responses. The caller provided it in the request already. Signed-off-by: Max <max@nextcloud.com>
enh/snowflake ids
Todo
Prerequisits
Backend
syncrequests with IContext.AttachmentServicebased on context.ApiService.pushrequests.Frontend
Provide these props when saving.We still use thedocumentIdto save and resolve the context on the backend.Testing
Feedback
removeInactiveSessionsWithoutSteps()within the create flow was removed, and not introduced back elsewhere.Documentation