# Feature COMMS-345 - Add internal comments to capabilities API

Project: Stream Communicator
Status: closed
URL: https://community.openproject.org/work_packages/COMMS-345

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 16.2.0 |
| Sprint |  |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Use cases

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Hagen Mahnke |
| Product manager |  |
| Feature Lead |  |
| Developers | OP Dev Comms Team |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

Follows <mention class="mention" data-id="64166" data-type="work_package" data-text="###64166">###64166</mention>

**As** an API client  
**I want to** be able to know if a user has the capability to add internal comments  
**so that** I can fully support internal comments in my application

**Acceptance criteria**

  - It is possible to check via the [**Capabilities API**](https://www.openproject.org/docs/api/endpoints/actions-capabilities/), whether a user has the capability to add internal comments

  - Using the following capability filers
    
      - internal\_comments/create. - Can create internal comments, has "add\_internal\_comments" permission
    
      - internal\_comments/read - Can read internal comments, has "view\_internal\_comments" permission
    
      - internal\_comments/update\_own - Can edit own internal comments, has "edit\_own\_internal\_comments" permission
    
      - internal\_comments/update\_others - Can edit others internal comments, has "edit\_others\_internal\_comments" permission

**Technical notes**

GET /api/v3/capabilities

``` json
// ?filters=

[
    {
        "principal": {
            "operator": "=",
            "values": [
                "435" // The current user ID
            ]
        }
    },
    {
        "context": {
            "operator": "=",
            "values": [
                "p861" // The Project ID
            ]
        }
    },
    {
        "action": {
            "operator": "=",
            "values": [
                "internal_comments/create"
            ]
        }
    }
]
```

*Similar Examples: In order to verify whether a user can create a reminder, we check that they are logged in and have the "work\_packages/read" capability E.g.* [*https://github.com/opf/openproject/commit/d10375c8cedcd1c0c58ac9448a5844a5b28d9075*](https://github.com/opf/openproject/commit/d10375c8cedcd1c0c58ac9448a5844a5b28d9075)

*Ref: <https://www.openproject.org/docs/api/filters/>*

**Permissions and visibility considerations**

  - Permission: "[add\_internal\_comments](https://github.com/opf/openproject/blob/dab3a3e18134067758d62dc41791eb1ef1d57fac/config/initializers/permissions.rb#L325)"

  - When the user does not have the "Write internal comments" and they attempt to mark a comment as internal, they should receive back an error AND the comment should never be created.
