Skip to content

feat(manifest): visibleIf.appInstalled nav filter#203

Closed
rubenvdlinde wants to merge 1 commit into
betafrom
feat/scholiq-deps/visible-if-app-installed
Closed

feat(manifest): visibleIf.appInstalled nav filter#203
rubenvdlinde wants to merge 1 commit into
betafrom
feat/scholiq-deps/visible-if-app-installed

Conversation

@rubenvdlinde
Copy link
Copy Markdown
Contributor

Summary

  • Adds visibleIf.appInstalled to the manifest nav item schema — a menu entry with visibleIf: { appInstalled: "mydash" } only renders when the named Nextcloud app is installed and enabled.
  • New src/utils/appInstalled.js utility checks OC.appswebroots first (per-user, most reliable), falls back to the capabilities API, and caches results per page-load so nav filtering is synchronous.
  • CnAppNav.passesVisibleIf() applies the filter to both top-level items and nested children; items without visibleIf are always visible (backwards-compatible).
  • validateManifest rejects unknown visibleIf keys (mirrors additionalProperties: false in the schema) to protect against typos like appIsInstalled.

Closes scholiq deps nc-vue #3 (as referenced in issue #200 §3).

Test plan

  • tests/utils/appInstalled.spec.js — 11 unit tests covering OC.appswebroots primary path, capabilities fallback, error path, and cache
  • tests/components/CnAppNav.spec.js — 9 integration tests covering hide/show, children, and edge-cases (visibleIf: {} passthrough)
  • tests/schemas/app-manifest.schema.spec.js — 10 validator tests covering valid usage, unknown keys, non-string/empty-string errors
  • Full suite: 974 pass, 4 pre-existing failures in CnAiChatPanel and CnMapWidget (both from the merged AI companion PR, unrelated to this change)

🤖 Generated with Claude Code

…s nc-vue #3)

Menu items can now declare a visibleIf.appInstalled condition that hides
cross-app links when the target Nextcloud app is not installed/enabled.
Uses OC.appswebroots (primary) then the capabilities API (fallback),
with a per-page-load cache so nav filtering is synchronous and cheap.

Changes:
- src/utils/appInstalled.js — new utility with cache + test-reset hook
- src/utils/index.js — export isAppInstalled from package barrel
- src/schemas/app-manifest.schema.json — visibleIf on menuItem + menuItemLeaf
- src/utils/validateManifest.js — validateMenuItemVisibleIf helper
- src/components/CnAppNav/CnAppNav.vue — passesVisibleIf method + filter
- src/components/CnAppNav/CnAppNav.md — visibleIf.appInstalled doc + example
- tests/utils/appInstalled.spec.js — 11 unit tests for the utility
- tests/components/CnAppNav.spec.js — 9 nav filter integration tests
- tests/schemas/app-manifest.schema.spec.js — 10 validator tests
@rubenvdlinde
Copy link
Copy Markdown
Contributor Author

Superseded — visibleIf.appInstalled (isAppInstalled utility, CnAppNav.passesVisibleIf() with appInstalled check, schema visibleIfCondition $def with appInstalled property) landed on beta via PR #212's consolidation. The appInstalled predicate is fully present on beta alongside context-path predicates. This branch is no longer needed.

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.

1 participant