Files
korean_comments_action/README.md
T

56 lines
3.4 KiB
Markdown
Raw Normal View History

# Korean comments action for Nextcloud 34
Minimal custom app that adds a **댓글** icon directly to each eligible Files row and opens that node's comments UI without using the `…` menu. On Nextcloud 34 with Activity enabled, comments are integrated into sidebar tab `activity`; if Activity is disabled, the app falls back to tab `comments`.
## Why these APIs
The installed Nextcloud 34.0.4 bundle uses `@nextcloud/files` 4.0.0. Its own Comments app implements the same flow with `registerFileAction()`, `getSidebar()`, `sidebar.open(node, tabId)`, and `sidebar.setActiveTab(tabId)`. The installed Activity app registers sidebar tab ID `activity`; Comments registers tab ID `comments` only when Activity integration is unavailable.
The PHP bootstrap listens for `OCA\Files\Event\LoadAdditionalScriptsEvent`, the supported event fired while Files is rendered, and loads the frontend with `OCP\Util::addInitScript()`.
## Build and automated checks
Use Node 24, matching the installed package engines:
```bash
npm ci
npm run typecheck
npm test
npm run build
```
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)
Copy the app directory to `/data/nextcloud/app/custom_apps/korean_comments_action`, retaining `appinfo/`, `lib/`, and generated `js/` (source/build metadata may also be retained), then run OCC in the Nextcloud PHP container as the web user:
```bash
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:
```bash
php occ app:disable korean_comments_action
```
## Manual acceptance test
1. Open **Files → Personal files**. Confirm one **댓글** icon appears directly on every eligible file row without opening the `…` menu.
2. Click **댓글**. Confirm the details sidebar opens for that exact filename, the **Activity** tab is active, existing comments load, and the comment composer is visible.
3. On the same file, switch to another sidebar tab and click **댓글** again. Confirm it switches back to Activity without closing the sidebar.
4. With the sidebar still open, use **댓글** on another file. Confirm the sidebar header and comments belong to the second file.
5. Select multiple rows. Confirm the action is not offered. Confirm it is also absent for nodes outside the supported `/files/<user>` tree or with `Permission.NONE`.
6. Optional fallback check on a test instance: disable Activity while leaving Comments enabled, reload Files, and confirm **댓글** opens the standalone **Comments** tab.
## Primary references
- Files event: https://docs.nextcloud.com/server/latest/developer_manual/basics/events.html
- Files frontend API: https://nextcloud-libraries.github.io/nextcloud-files/
- `registerFileAction`: https://nextcloud-libraries.github.io/nextcloud-files/functions/index.registerFileAction.html
- `getSidebar`: https://nextcloud-libraries.github.io/nextcloud-files/functions/index.getSidebar.html
- Bootstrap API: https://docs.nextcloud.com/server/latest/developer_manual/app_development/bootstrap.html