# Bug COMMS-96 - Improve error handling when two users edit the same work package in parallel (conflict)

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

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | High |
| Module |  |
| Target versions | 15.0.0 |
| Observed in versions | 14.6.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) | 14.6.x |
| Requires doc change | Yes |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Wieland Lindenthal |
| Product manager |  |
| Developers |  |
| Designer | Parimal Satyal |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

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

## Costs

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

## Description

#### Context

In the context of changes made to polling in <mention class="mention" data-id="54733" data-type="work_package" data-text="##54733">##54733</mention>, the error message concerning conflicting modifications to a work package is particularly misleading. This is an effort to improve that.

#### Steps to reproduce

In the current production version of OpenProject (Community):

  - User A enters edit mode of a work package (any field, not necessarily description)

  - User A makes changes

  - User B modifies the same work package in parallel

  - User A tries to save the (unbenowst to them) now-stale work package

#### **Buggy behaviour**

  - The user receives the following error, with a link to reload the page to load the updated version.

  - However, if the user is still editing an attribute (eg. the description is in edit mode), the user will still have the stale content for that attribute.

  - The conflict is then not resolved.

<img class="image_resized op-uc-image op-uc-image_inline" style="width:663px;" src="/api/v3/attachments/234553/content">

#### **Expected behaviour**

  - When a change is detected in the work package by another user or in another window (i.e., the work package is now "stale"):
    
      - Automatically display a **warning message**.
    
      - Use the existing Primerised Refresh banner, but in a warning yellow.
    
      - Text: "This page has been updated by someone else. To not lose your edits, copy them locally and reload to view the updated version."
    
      - Action: **Discard changes and reload**.
        
          - This triggers a browser refresh.

  - If the user, despite the warning, tries to save their changes:
    
      - Display an **error message**.
    
      - Use the existing Primerised Refresh banner, in red. (If possible, else use the existing Angular one)
    
      - Supress the warning banner in favour of the error one.
    
      - Text: "Could not save your changes because of conflicting modifications. To not lose your edits, copy them locally and reload to view the updated version."
    
      - Action: **Discard changes and reload** (Browser refresh)'

#### Reference

A reference of the Primerised Refresh banner:

<img class="image_resized op-uc-image op-uc-image_inline" style="width:843px;" src="/api/v3/attachments/234555/content">

#### **Notes**

  - Known limitation: Some edits cannot really be copied, so the message doesn't work in all cases. It is nevertheless an improvement.

  - This is a stop-gap solution to slightly improve on what already exists.
    
      - We'll work on a better solution as a separate feature, perhaps:
        
          - with diff-ing that allows users to better understand the conflict
        
          - concurrent editing of *different* attributes doesn't trigger the error

### Environment information

**Community**  
OpenProject 14.6

**Browser:**  
Firefox, Mac (desktop)

**Language**  
EN
