Repository navigation
feat(pages): page and widget type API (#3100, step 2) - #47
Open
rubenvdlinde wants to merge 1 commit into
Open
rubenvdlinde wants to merge 1 commit into
rubenvdlinde wants to merge 1 commit into
Conversation
GET, POST, PATCH and DELETE /api/2/contexts/{contextId}/pages[/{pageId}]
and GET /api/2/widget-types per nextcloud#3100. PATCH changes the
title, emoji and description and syncs the widgets of a grid page by id in
one transaction. Settings are validated against the schema of their widget
type; a data widget's source must be a node of the application, or a table
or view the user manages, which is added to the application first.
Imported widgets are validated the same way.
Assisted-by: ClaudeCode:claude-opus-5-5
This was referenced Oct 16, 2026
This file contains hidden or 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
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.
Step 2 of the page rework on nextcloud#3100 (follows the review on nextcloud#3075). Stacked on #46.
What
GET /api/2/contexts/{contextId}/pages/{pageId}: a page with its widgets (settingsmap,source: {nodeRelId}or null). Read access on the application.POST /api/2/contexts/{contextId}/pages: add a grid page withtitle,emoji,description.PATCH /api/2/contexts/{contextId}/pages/{pageId}: change the page fields (left out keeps, empty emoji/description removes) and/or sendwidgets. The widgets of the page are synced by id in one transaction: listed ids are updated, widgets without an id are inserted, widgets of the page that are not listed are deleted. An id of another page is a 400.DELETE /api/2/contexts/{contextId}/pages/{pageId}: grid pages only, 400 for the start page; deletes widgets, settings and sources.GET /api/2/widget-types: header, text ("Description") and data, each with its settings schema andhasSource.RequirePermissionMANAGE in the middleware, checked again inPageService). Non-members get 404.GridWidgetTypes, carried over from the earlier stack and reduced to onesettingsschema per type; unknown settings are dropped, defaults filled in). A source on a type without one is a 400.{nodeRelId}of this application (400 otherwise) or{nodeType, nodeId}; the latter is added to the application (and its start page, likeContextService::update) after the samecanManageNodeByIdcheck, 403 if not allowed.importContext) are validated against the types too; invalid ones are skipped.nextcloud#3100 points covered
API (all five endpoints), "Saving a page syncs its widgets by id in one transaction", "Reading needs read access to the application. Changes need manage access", "The server checks every setting against the type's schema on save".
Tests (Nextcloud 34, PostgreSQL 16, in the container)
tests/unit/Service/PageServiceTest.php:OK (26 tests, 71 assertions)(sync, node add, 403 on unmanaged node and non-manager, 400 cases, start page)tests/unit/Controller/ContextPageControllerTest.php:OK (13 tests, 23 assertions)(200/400/403/404 mapping)tests/unit/Service/GridWidgetTypesTest.php:OK (9 tests, 29 assertions)tests/unit/Service/WidgetServiceTest.php(real DB, incl. sync):OK (7 tests, 22 assertions)tests/unit/Service/ContextServiceTest.php:OK (6 tests, 20 assertions);ContextPagesRoundTripTest.php(real DB):OK (2 tests, 10 assertions)OK (420 tests, 857 assertions)nodeRelId400; read-only sharee GET 200 and POST/PATCH/DELETE 403; non-member 404 on all four.composer cs:check: no files;psalm: no errors. Inherited: the OpenAPI generator's existing warnings on other controllers.Note: an empty
settingsmap serializes as[](PHP array), as elsewhere in the API.Prepared in the Conduction fork for porting upstream by @remko48. Prepared with Claude Code.