[verified] fix Nextcloud comment action loading

This commit is contained in:
2026-09-19 08:29:09 +00:00
parent 1206e8d332
commit 56df1251b9
7 changed files with 23 additions and 8 deletions
+3 -1
View File
@@ -19,7 +19,7 @@ npm test
npm run build npm run build
``` ```
The production entry is generated as `js/korean_comments_action-main.mjs`. `Util::addInitScript(Application::APP_ID, 'main')` resolves that app-prefixed asset. The production entry is generated as `js/korean_comments_action-main.mjs`. The listener therefore calls `Util::addInitScript(Application::APP_ID, Application::APP_ID . '-main')`; passing only `'main'` would incorrectly resolve the nonexistent `js/main.mjs`.
## Deployment commands (not run during this investigation) ## Deployment commands (not run during this investigation)
@@ -29,6 +29,8 @@ Copy the app directory to `/data/nextcloud/app/custom_apps/korean_comments_actio
php occ app:enable korean_comments_action php occ app:enable korean_comments_action
``` ```
The app declares the `filesystem` type so its Files event listener is registered early. When upgrading from a build that lacked this type, disable and re-enable the app once so Nextcloud refreshes the persisted app type before restarting the app container.
Disable/rollback with: Disable/rollback with:
```bash ```bash
+4 -1
View File
@@ -5,10 +5,13 @@
<name>Korean comments action</name> <name>Korean comments action</name>
<summary>Adds a 댓글 action to the Files row menu</summary> <summary>Adds a 댓글 action to the Files row menu</summary>
<description>Adds a Korean-labeled file action that opens the Activity/comments sidebar.</description> <description>Adds a Korean-labeled file action that opens the Activity/comments sidebar.</description>
<version>1.0.0</version> <version>1.0.1</version>
<licence>agpl</licence> <licence>agpl</licence>
<author>Hera (헤라)</author> <author>Hera (헤라)</author>
<namespace>KoreanCommentsAction</namespace> <namespace>KoreanCommentsAction</namespace>
<types>
<filesystem/>
</types>
<category>files</category> <category>files</category>
<dependencies> <dependencies>
<nextcloud min-version="34" max-version="34"/> <nextcloud min-version="34" max-version="34"/>
+1 -1
View File
@@ -138,7 +138,7 @@ This file is generated from multiple sources. Included packages:
- version: 1.1.15 - version: 1.1.15
- license: MIT - license: MIT
- korean-comments-action - korean-comments-action
- version: 1.0.0 - version: 1.0.1
- license: undefined - license: undefined
- math-intrinsics - math-intrinsics
- version: 1.1.0 - version: 1.1.0
+1 -1
View File
@@ -17,6 +17,6 @@ final class LoadFilesScript implements IEventListener {
return; return;
} }
Util::addInitScript(Application::APP_ID, 'main'); Util::addInitScript(Application::APP_ID, Application::APP_ID . '-main');
} }
} }
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "korean-comments-action", "name": "korean-comments-action",
"version": "1.0.0", "version": "1.0.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "korean-comments-action", "name": "korean-comments-action",
"version": "1.0.0", "version": "1.0.1",
"dependencies": { "dependencies": {
"@nextcloud/files": "4.0.0", "@nextcloud/files": "4.0.0",
"@nextcloud/initial-state": "3.0.0" "@nextcloud/initial-state": "3.0.0"
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "korean-comments-action", "name": "korean-comments-action",
"version": "1.0.0", "version": "1.0.1",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "vite build", "build": "vite build",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"test": "vitest run" "test": "python3 tests/check_php_asset.py && vitest run"
}, },
"dependencies": { "dependencies": {
"@nextcloud/files": "4.0.0", "@nextcloud/files": "4.0.0",
+10
View File
@@ -0,0 +1,10 @@
from pathlib import Path
root = Path(__file__).resolve().parents[1]
listener = (root / "lib/Listener/LoadFilesScript.php").read_text()
expected_call = "Util::addInitScript(Application::APP_ID, Application::APP_ID . '-main');"
assert expected_call in listener, "listener must load the exact app-prefixed Vite asset"
assert (root / "js/korean_comments_action-main.mjs").is_file(), "built module is missing"
print("php asset link ok")