Repository navigation
fix(contexts): keep the nodes added by an application update in the loaded shape - #3230
Conversation
AndyScherzinger
left a comment
There was a problem hiding this comment.
Review focused on performance, security, clean code and architecture (backend only). The checks ran on a dev instance (MariaDB) with #3133 deployed and this commit applied on top, since the PR merges after #3133.
The fix is right: the hand-built arrays match ContextMapper::formatResultRows() key for key and type for type on main and on #3133, a PUT that adds a node logs no "Undefined array key" warning any more, its nodes and pages equal those of the following GET, and the added table takes its place on the start page (an application with table 1 that gets table 2 added now stores orders 10 and 20, where main stored 10 and 10).
Merging after #3133: the service change applies cleanly; the test file conflicts in setUp() in two hunks ($widgetService/$dbConnection against $permissionsService). Both resolve to #3133's side; keeping both declarations of $permissionsService is a fatal "Cannot redeclare".
CI: green.
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
03e55ff to
9eb9d29
Compare
|
/backport to stable2 |
|
The shared formatter for nodes and page contents is now #3345. |
|
please resolve the conflicts |
…oaded shape Updating an application with new tables or views stored the added nodes and start page contents in their JSON shape (nodeType, nodeId, nodeRelId) next to the loaded ones (node_type, node_id, node_rel_id). Ordering the start page then read keys that were not there, which raised an "Undefined array key" warning and left the new contents unordered, and the returned application mixed both shapes. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Added nodes are inserted at their final order, so the reorder after them no longer rewrites their content. A node without an order keeps its position in the list. The tests record the orders written to the database. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
9eb9d29 to
7b15be9
Compare
Adding a table or view to an application through
PUT /api/2/contexts/{id}logs a PHP warning,Undefined array key "node_type", and the new table doesn't take its place on the start page.Size: 60 lines: 13 code and 47 tests.
What changes
ContextService::update()keeps the nodes and start page contents of the application in two arrays while it works through the submitted list. The loaded ones come fromContextMapperwith snake case keys (node_type,node_id,node_rel_id). Nodes added during the update went in throughjsonSerialize(), which uses camel case (nodeType,nodeId,nodeRelId). Ordering the start page afterwards reads the snake case keys, so for an added node it:Undefined array key "node_type"and"node_id"for the node, and"node_rel_id"for its start page content,nodesandpagesmixed both shapes.Added nodes and contents now go into those arrays in the same shape the mapper loads them in.
How it was tested
New test in
ContextServiceTest: an application with one table gets a view added in front of it. The view comes back in the loaded shape, its start page content gets order 10, and the table moves to 20.🖼️ Screenshots
Backend only, no visual change.
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)