77 lines
5.0 KiB
Markdown
77 lines
5.0 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 that count to choose the row icon. It also registers a custom Files sidebar tab and mounts Nextcloud's native `OCA.Comments.View` there. This keeps the existing interface and permission rules for writing, reading, mentioning users, editing, and deleting comments while keeping unrelated Activity entries out of the way.
|
|
|
|
When a file has unread comments, the app reuses Nextcloud's built-in `comments-unread` action instead of adding a second icon. Both actions use the same icon style and open the dedicated comments-only tab.
|
|
|
|
## Screenshot
|
|
|
|

|
|
|
|
The selected file has comments, so its row shows the square-with-dots icon. Files without comments show an empty square. The dedicated **댓글** tab contains the native comment composer and history without mixing in Activity entries.
|
|
|
|
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
|
|
|
|
Copy the app directory to `/data/nextcloud/app/custom_apps/korean_comments_action`. Keep `appinfo/`, `lib/`, and the generated `js/` directory, 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 that each eligible row shows an icon without a `댓글` text label and without opening the `…` menu.
|
|
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 that the dedicated **댓글** tab opens for that file and shows the comment box and existing comments, 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 and confirm that the action is hidden. It should also be hidden for items outside the supported `/files/<user>` tree, items without a file ID, items with `Permission.NONE`, and whenever 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
|
|
|
|
## Upstream discussion
|
|
|
|
The findings and prototype design were shared in an existing Nextcloud issue. The GitHub comment states that an AI agent wrote it at the user's request and posted it with the user's explicit permission:
|
|
|
|
- https://github.com/nextcloud/server/issues/31422#issuecomment-5740952201
|
|
|
|
## License and public access
|
|
|
|
This is a public repository distributed under the **GNU Affero General Public License v3.0 or later (`AGPL-3.0-or-later`)**, the same license used by Nextcloud Server and the Nextcloud Files frontend library. Anyone may download, inspect, use, modify, and redistribute the source under those terms. Visitors can view or clone the repository without signing in, but only authorized maintainers can push changes.
|
|
|
|
See [LICENSE](LICENSE) for the complete terms.
|