Repository navigation
feat(contexts): give applications a menu with its own API - #3135
Open
rubenvdlinde wants to merge 30 commits into
Open
rubenvdlinde wants to merge 30 commits into
rubenvdlinde wants to merge 30 commits into
Conversation
This was referenced Oct 22, 2026
rubenvdlinde
force-pushed
the
feat/noid/app-menu-model
branch
from
October 22, 2026 13:25
9847aa9 to
5825db2
Compare
rubenvdlinde
force-pushed
the
feat/noid/app-menu-model
branch
from
October 23, 2026 08:05
5825db2 to
9e81a78
Compare
rubenvdlinde
force-pushed
the
feat/noid/app-menu-model
branch
2 times, most recently
from
October 26, 2026 09:24
7e236cc to
c7a6e95
Compare
rubenvdlinde
marked this pull request as ready for review
October 26, 2026 09:25
enjeck
reviewed
Oct 31, 2026
This was referenced Nov 2, 2026
rubenvdlinde
marked this pull request as draft
November 2, 2026 11:14
rubenvdlinde
force-pushed
the
feat/noid/app-menu-model
branch
from
November 2, 2026 11:17
c7a6e95 to
8574da7
Compare
rubenvdlinde
force-pushed
the
feat/noid/app-menu-model
branch
2 times, most recently
from
November 3, 2026 14:51
9af2352 to
7d89fa5
Compare
This was referenced Nov 3, 2026
rubenvdlinde
force-pushed
the
feat/noid/app-menu-model
branch
from
November 4, 2026 10:42
7d89fa5 to
aa0c7e3
Compare
3 of 5 tasks
Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
rubenvdlinde
force-pushed
the
feat/noid/app-menu-model
branch
from
December 1, 2026 06:37
5509db2 to
4236e8f
Compare
This was referenced Dec 1, 2026
Contributor
Author
|
Thanks for the thorough review. All of it is addressed, and the branch is rebased onto current main, with the conflicts resolved and OpenAPI regenerated.
cc @blizzz |
This was referenced Dec 1, 2026
Open
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.
Part of the stack on #3133. Implements the menu proposal on #3100: the model and the API. Export and import follow in #3138. This replaces the earlier version of this pull request, together with #3136 and #3137.
Size: 4932 lines: 1405 code, 1362 tests, 2157 generated OpenAPI and 8 version.
Agreed on #3100
page_id,node_rel_id,url), of which at most one is set. The service enforces it; the rule is in the entity docblock./api/2/contexts/{contextId}/menu.What changes
{pageId}), a table or view of the application by its node relation ({nodeRelId}), or an http or https link ({url}). An item that opens nothing is a group. Groups are top-level and only groups hold items, so a menu is one level deep.title(as stored) anddisplayTitle.nodes, a scheme import, or because the table or view is deleted, also with its owner), and with the application. The items of a deleted group move to the top level.#[ApiRoute]:GET /api/2/contexts/{contextId}/menureturns the menu as a flat list in display order, withparentIdPOST /api/2/contexts/{contextId}/menuadds an item to the end:title,icon,description,targetPATCH /api/2/contexts/{contextId}/menu/{itemId}changes an item; a target replaces the previous one, a group that holds items can't get one, and the only item that opens the start page keeps that targetDELETE /api/2/contexts/{contextId}/menu/{itemId}deletes an item; the only item that opens the start page gets a 400PUT /api/2/contexts/{contextId}/menu/ordertakesitems: [{id, parentId}]in display order. It lists every item exactly once, a parent is a top-level group listed before its items, and it saves all of it or nothing ("changed in between, reload"). It returns the whole menu, and saves the order in one query.GET /menureturns anETag, and the order save needs it inIf-Match. A stale version gives a 409, a missingIf-Matcha 400. Response bodies don't change.#[RequirePermission]covers every endpoint, and the service checks manage rights on the application for every write itself, so the route's check is not the only guard (the fixed node type for the route attribute is fix(middleware): let a route fix the node type to an application #3415). Readers who can't manage the application don't see items that open a table or view the application gives them no read permission on.TextHelperfor text and icons): blanks at either end, including no-break and zero width spaces, are trimmed. A menu link accepts the scheme in any case (HTTPS://…); link cells are unchanged.A page has an unknown icon: XbecomesThe icon of a page must be the name of an icon., andA page description has at most 2000 characters.becomesThe description of a page must be a text of at most 2000 characters.A page icon is trimmed byTextHelper::trim()instead oftrim(), so an icon wrapped in no-break or zero width spaces is accepted.#[UserRateLimit]: 20 a minute on every menu write.3.0.0-dev.3(main is at3.0.0-dev.1, feat(pages): let widgets sit in the tabs of a tabs widget #3212 takes3.0.0-dev.2).How it was tested
After the reviews, including the review of 30 November, with PostgreSQL:
MenuServiceTestagainst the database: the start page item of a new application, title fallback for every kind of target, invalid items (data provider), at most one target, empty groups hidden from readers, the 200-item cap, PATCH semantics, a group with items can't get a target, order and grouping, deleting a group, invalid orders that save nothing (data provider), cleanup with the page, the node and the application, a dangling item left out, only managers change the menu (the four writes as a reader, data provider), an item not found through another application, the only start page item can't be deleted or pointed elsewhere and can be deleted when another item opens the start page, and a reader doesn't see items of a table or view with permissions 0MenuControllerTest: arguments passed on and every error mapped to its status (data providers); aPermissionErroris a 403 on every write, aBadRequestErrora 400 on delete toophp-cs-fixer, clean; OpenAPI regenerated and in step with the codeBy hand on a test instance (Nextcloud 34, PostgreSQL), through the API, 18 checks, all as expected. These were done before the fixes of 30 November; the checks on a live instance below were done after them:
GET /api/2/menuis gone (404)How it was tested on a live instance
On Nextcloud 34 with PostgreSQL, with an owner, a reader and an outside user, through the API. A new application has one item, for its start page, and
GET /menureturns anETag. The only start page item cannot be deleted or pointed elsewhere (400); it can be renamed and moved into a group. With a second start page item either one can be deleted, and adding an item never brings a deleted one back, also in an application that has no items. A reader gets 403 on add, change, delete and order (with a fresh ETag), also with?context=tableand?context=0while owning a table with the application's id, and the menu stays the same; an outside user gets 404. Items on a table added with permissions 0, with and without a title, are shown to the owner; the reader sees neither item and not the table's title.HTTPS://nextcloud.comis accepted as a menu link, the 201st item is refused, and an order save withoutIf-Matchgives 400 and with a stale one 409. Link cells and widget icons behave as on main. In the browser the application opens on its start page for the owner and for the reader.🖼️ Screenshots
Backend only, no UI changes.
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)