Skip to content

[stable34] feat(direct-editing): integrate with OCP\DirectEditing API - #5734

Merged
elzody merged 10 commits into
stable34from
backport/5656/stable34
Jun 9, 2026
Merged

elzody merged 10 commits into
stable34from
backport/5656/stable34

Conversation

@backportbot

@backportbot backportbot Bot commented Jun 8, 2026

Copy link
Copy Markdown

Backport of PR #5656

juliusknorr and others added 10 commits June 8, 2026 23:52
Plug richdocuments into the server's shared Direct Editing API so
mobile apps (and any other clients) can open Collabora documents
through the standard /ocs/v2.php/apps/files/api/v1/directEditing/...
endpoints, alongside other editors registered via OCP\DirectEditing.

- Add OfficeDirectEditor (IEditor) and four ACreateFromTemplate
  creators (document, spreadsheet, presentation, drawing) backed by
  the existing TemplateManager and FileCreatedFromTemplateListener.
- Extract the user/file render branch of DirectViewController::show
  into DirectEditingViewService so both the new IEditor::open path
  and the legacy /direct/{token} webview share one implementation
  (federation redirect, template-aware WOPI token, document template
  response).
- Route the legacy OCS endpoints (/api/v1/document and
  /api/v1/templates/new) through OCP\DirectEditing\IManager and mark
  them deprecated; response shape unchanged.
- Keep the share/federation flows (/api/v1/share,
  /api/v1/direct/share/initiator and the /direct/{token} webview)
  untouched -- they have no equivalent in OCP\DirectEditing.
- Factor Capabilities mimetype dedup into helpers so the editor and
  the capability advert read from one source of truth.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Julius Knorr <jus@bitgrid.net>
…w" wording

Signed-off-by: Julius Knorr <jus@bitgrid.net>
array_diff preserves the original keys, which makes JSON encode the
capability as an object instead of a list when application/pdf is
removed. Reindex with array_values so the response stays a list.

AI-assistant: claude-code 2.0.45 (claude-opus-4-7)
Signed-off-by: Julius Knorr <jus@bitgrid.net>
The render() docblock was sitting above primeTemplateSource() with no
method attached, so IDE/static analysis tooling could not associate it
with the method it describes. Move it to render() where it belongs.

AI-assistant: claude-code 2.0.45 (claude-opus-4-7)
Signed-off-by: Julius Knorr <jus@bitgrid.net>
$userFolder->getRelativePath() can return null for nodes outside the
user folder, which would TypeError when passed to
IManager::open(string $filePath, ...). Fall back to the file name —
Manager::open resolves the node by the supplied fileId anyway.

AI-assistant: claude-code 2.0.45 (claude-opus-4-7)
Signed-off-by: Julius Knorr <jus@bitgrid.net>
The previous code took the file extension from the requested target
path. Filenames don't require an extension and a caller can also
pick one that disagrees with the chosen template, which would route
the call to the wrong creator and fail. Look up the template and
resolve the creator from its mimetype instead.

Adds TemplateManager::getTemplateTypeForMime() as the mime ↔ type
counterpart of the existing getTemplateTypeForExtension().

AI-assistant: claude-code 2.0.45 (claude-opus-4-7)
Signed-off-by: Julius Knorr <jus@bitgrid.net>
UI menu items are capitalised ('Document', 'Spreadsheet', …) but
callers pass lowercase ('document', …). The cy.contains() match was
failing for that reason. Capitalise the first letter and lowercase
the rest before searching so existing call sites keep working.

AI-assistant: claude-code 2.0.45 (claude-opus-4-7)
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Other editors integrating with OCP\DirectEditing on mobile (notably
the text app) send a generic 'loaded' message when their editor is
ready. Emit the same alongside the long-standing
richdocuments-specific 'documentLoaded' so clients that listen to
the shared signal work without an editor-specific branch.

AI-assistant: claude-code 2.0.45 (claude-opus-4-7)
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Older iOS/Android clients already drive document editing through
the legacy /apps/richdocuments/api/v1/document endpoint. They have
no integration with the new OCP\DirectEditing flow, so listing the
richdocuments editor in /apps/files/api/v1/directEditing would only
confuse them. Skip registration in the listener when the request
comes from a Nextcloud iOS/Android client whose major version is
below 34.

The legacy OCS endpoints register the editor directly on the manager
so the in-process delegation to IManager keeps working for those
older clients (they still hit /api/v1/document and get a valid
direct-editing URL back).

AI-assistant: claude-code 2.0.45 (claude-opus-4-7)
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Signed-off-by: Julius Knorr <jus@bitgrid.net>
@backportbot
backportbot Bot requested review from elzody and juliusknorr as code owners June 8, 2026 23:52
@backportbot
backportbot Bot requested a review from elzody June 8, 2026 23:52
@backportbot backportbot Bot added 3. to review Ready to be reviewed technical debt labels Jun 8, 2026
@elzody
elzody merged commit 23577ba into stable34 Jun 9, 2026
79 checks passed
@elzody
elzody deleted the backport/5656/stable34 branch June 9, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Ready to be reviewed technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants