Project

General

Profile

Feature #1698

Prevent accidentally deletion of type links

Added by Alexander Watzinger 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
Backend
Target version:
Start date:
2022-04-20
Estimated time:

Description

If an entity has already multiple types linked for a type that is meant to be single there is a danger of losing data. Data loss would occur when updating this entity because the form would show a single field select with just the first value selected. If the user than saves the entity all other type links would get lost without the user noticing it.

Although this shouldn't happen in the application, it could be that e.g. because of bugs, imports or similar this situation arises nevertheless.
To prevent accidentally deletion of type links the application should prevent updating this entity and inform the user about this inconsistency.

Implementation
  • A warning is displayed in the entity view with information about the problematic type and a link to the manual on how to solve this.
  • The edit button is removed but even if a user tries to edit this entity (e.g. with a bookmarked link), they get redirected to an 422 error.

History

#1

Updated by Bernhard Koschiček-Krombholz 5 months ago

  • Description updated (diff)
  • Status changed from In Progress to Closed
#2

Updated by Alexander Watzinger 5 months ago

  • Subject changed from Prevent accidentely deletion of multiple types to Prevent accidentally deletion of type links
  • Description updated (diff)
Thank you Bernhard for working on this with me. After sleeping over it I did some refinements:
  • Moved the check function from util -> model/entity
  • Removed the edit button if type problems are detected
  • Refined the error text and display a link to the offending type
  • Added a link to the manual (there are checks and tools to solve it at admin/data/check_link_duplicates)

It's already in the develop branch. This is another important feature to guarantee data integrity so thanks again for working with me on this.

Also available in: Atom PDF