Skip to content

feat(files): surface .pad files under the 'Documents' type filter (#27)#130

Draft
Jaggob wants to merge 1 commit into
mainfrom
feature/27-pads-filter
Draft

feat(files): surface .pad files under the 'Documents' type filter (#27)#130
Jaggob wants to merge 1 commit into
mainfrom
feature/27-pads-filter

Conversation

@Jaggob

@Jaggob Jaggob commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

What

Make .pad files appear in the Files app's type filter, without DOM-patching the (non-public) filter Vue UI.

Approach

Alias the application/x-etherpad-nextcloud mimetype onto the core x-office/document type in the RegisterMimeType repair step. The Files type filter matches a node against each category's mimetypes including the mimetype alias (OC.MimeTypeList.aliases[mime]), so aliased pads show up under the built-in Documents filter. No JS, no new dependency; works across the whole supported NC range (the mimetype-alias mechanism is stable, unlike the v4-only registerFileListFilter API).

Regenerating the browser alias map (the important bit)

The type filter reads OC.MimeTypeList.aliases, which is baked into core/js/mimetypelist.js. Nextcloud does not regenerate that file on app install/enable — so without action the alias would sit in config/mimetypealiases.json but the filter wouldn't pick pads up until someone ran occ maintenance:mimetype:update-js. The repair step therefore regenerates mimetypelist.js itself (best-effort): it mirrors the maintenance command using the public IMimeTypeDetector::getAllAliases() / getAllNamings() plus the core file builder, guarded by class_exists / method_exists / writability checks and a try/catch, and falls back to logging the manual command on any mismatch. (Thanks @codex for catching this.)

Icons

The file list keeps the pad glyph (rows render the PadPreviewProvider thumbnail, not the mimetype icon) and the "New" menu uses its own etherpad icon. The generic document icon only appears where no preview is rendered (file-picker dialogs / search). The now-obsolete custom mimetype-icon sync is dropped.

Acceptance

  • .pad files appear in the Files type filter (under Documents)
  • No DOM patching of the Vue filter UI
  • Works across the info.xml NC range
  • No manual maintenance command required (repair step regenerates the alias JS)

Verification

  • PHPUnit 409 + Psalm green.
  • Live on NC 33 via occ maintenance:repair: the alias is written and mimetypelist.js is regenerated automatically (confirmed by blanking the alias from the JS and watching the repair step restore it). Pads show under the Documents filter; file-list pad icon preserved.
  • Full Playwright suite green (pad create/open unaffected by the alias change).

Diff

lib/Migration/RegisterMimeType.php (alias + JS-map regeneration, drop obsolete icon sync), .gitignore (ignore stray root screenshots/probe scripts).

Closes #27.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94f3498cce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/Migration/RegisterMimeType.php
@Jaggob Jaggob force-pushed the feature/27-pads-filter branch 3 times, most recently from 12a53f2 to 9d7fa47 Compare June 6, 2026 12:46
Alias the `application/x-etherpad-nextcloud` mimetype onto the core
`x-office/document` type in the RegisterMimeType repair step. The Files type
filter matches a node against each category's mimetypes including the mimetype
alias (`OC.MimeTypeList.aliases[mime]`), so aliased pads appear under the
built-in 'Documents' filter — no DOM patching, no JS bundle, no new runtime
dependency, and it works across the supported NC range.

The browser alias map lives in core/js/mimetypelist.js, which Nextcloud does
NOT regenerate on app install/enable — so the repair step now regenerates it
itself (best-effort: mirrors maintenance:mimetype:update-js via the public
getAllAliases/getAllNamings + the core file builder, guarded by class_exists /
method_exists / writability and a try/catch; falls back to logging the manual
command). Without this the Documents filter would only pick up pads after a
manual `occ maintenance:mimetype:update-js`.

Icons: the file list keeps the pad glyph (PadPreviewProvider thumbnail), and
the 'New' menu uses its own etherpad icon; the generic document icon only
shows on no-preview surfaces (file-picker / search). The obsolete custom
mimetype-icon sync is dropped.

Verified live on NC 33 via occ maintenance:repair: the alias is written and
mimetypelist.js is regenerated automatically; pads show under the Documents
filter, file-list pad icon preserved. PHPUnit 409 + Psalm green; Playwright
23/23.

Closes #27.
@Jaggob Jaggob force-pushed the feature/27-pads-filter branch from 9d7fa47 to 1748c07 Compare June 6, 2026 21:31
@Jaggob Jaggob marked this pull request as draft June 6, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show .pad files in the Nextcloud Files type filter

1 participant