59 lines
3.9 KiB
Markdown
59 lines
3.9 KiB
Markdown
# Korean comments action for Nextcloud 34
|
|
|
|
Minimal custom app that adds an icon-only **댓글** action directly to each eligible Files row. An empty square means no comments; a square containing three dots means at least one comment exists. Clicking either icon opens a dedicated **댓글** sidebar tab containing only the native comment composer and comment history, not the Activity feed.
|
|
|
|
## Why these APIs
|
|
|
|
The installed Nextcloud 34.0.4 bundle uses `@nextcloud/files` 4.0.0. The app registers `oc:comments-count` before the Files listing loads, then uses the count to choose the row icon. It registers a supported custom Files sidebar tab and mounts Nextcloud Comments' native `OCA.Comments.View` in that tab, retaining native creation, history, edit, delete, mention, and permission behavior while avoiding the mixed Activity feed.
|
|
|
|
Nextcloud's built-in `comments-unread` row action is reused when unread comments exist so users still see only one comment icon. Its click target and icon are aligned with the dedicated comments-only tab; the custom action covers rows without unread comments.
|
|
|
|
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 each eligible row shows only an icon without a `댓글` text label or a required `…` menu click.
|
|
2. Confirm a file with no comments uses an empty square and a file with one or more comments uses a square containing three dots.
|
|
3. Click either icon. Confirm the dedicated **댓글** tab opens for that exact file and contains the comment input plus comment history, with no Activity entries.
|
|
4. Create a comment, then edit and delete one of your own comments. Confirm the native controls and list updates work.
|
|
5. Click the same file's icon again while the sidebar is already open. Confirm the dedicated **댓글** tab remains active and never falls back to **활동**.
|
|
6. With the sidebar still open, use the icon on another file. Confirm the sidebar header, input, and comments belong to the second file.
|
|
7. Select multiple rows. Confirm the action is not offered. Confirm it is also absent for nodes outside the supported `/files/<user>` tree, nodes without a file ID, nodes with `Permission.NONE`, or when the Comments app is unavailable.
|
|
|
|
## 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
|