# Bug OP-10256 - Cannot add attachment to existing comment

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-10256

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 12.2.0 |
| Observed in versions | 12.0.0 |
| Sprint | 12.2.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 12.0.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### **Environment**:

community.openproject.org (12.1.0)

Chrome

### **Steps to reproduce:**

1.  Open work package notification in notification center.
2.  Edit entry in latest activity (comment) and add image (which is a screenshot taken e.g. with Snipping tool (but not saved)).
3.  Paste it into comment.

### **Actual Behavior**

Error message shown. Image not added.

<figure class="image op-uc-figure" style="width:50%;"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/30755/content"></div></figure>

<figure class="image op-uc-figure" style="width:50%;"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/30754/content"></div></figure>

### **Expected Behavior**

Image added.

### Implementation notes

*   Instead of destroying an existing journal after the successor is created:
    *   Check before whether the topmost journal will be replaced. If that is the case continue.
    *   Clean the data holding journal tables of the references to the journal to be replaced:
        *   `xyz_journals` (e.g. `work_package_journals`)
        *   `customizable_journals`
        *   `attachable_journals`
    *   Update `journals` table (e.g. `notes` and `updated_at`)
    *   Create data holding journal entries (see above)
*   There might already be `notifications` entries created when the journal is updated. Either all of those or those that are `:mentioned` need to be set to `read_ian`  false
