Skip to content

V9: Prevent delete or unpublish of items that have references#12047

Merged
bergmania merged 6 commits intov9/feature/item-trackingfrom
v9/feature/item-tracking-prevent-delete-or-unpublish
Feb 24, 2022
Merged

V9: Prevent delete or unpublish of items that have references#12047
bergmania merged 6 commits intov9/feature/item-trackingfrom
v9/feature/item-tracking-prevent-delete-or-unpublish

Conversation

@elit0451
Copy link
Contributor

@elit0451 elit0451 commented Feb 24, 2022

Details

  • By adding the following config options, editors are prevented from deleting Content or Media items (or their descendants) that have references from other items:
"Umbraco": {
  "CMS": {
      "Content": {
        . . .
        "DisableDeleteWhenReferenced": true,
        "DisableUnpublishWhenReferenced": true
      },
    . . .
  }
}
  • When the options are set, if the items (or their descendants) have references, the "delete" button will not appear, as well as the confirmation prompt;
    • A new warning is also shown;
  • In the bulk delete Content or Media items, the "delete" button is disabled, as well as the confirmation prompt;
  • In the unpublish case, the "unpublish" button is disabled;
  • If the items have no references, the delete or unpublish dialogues are unchanged!

Test

  • Add the above options ⬆️ to your config;
  • Have the SK installed
    • Try to delete Content item with and without reference -> Observe the difference;
    • Try to delete Media item with and without reference -> Observe the difference;
    • Try to unpublish Content item with and without reference -> Observe the difference;
    • Try to bulk delete Content items (from the list view) with and without reference -> Observe the difference;
    • Try to bulk delete Media items (from the list view) with and without reference -> Observe the difference;
    • Try to bulk unpublish Content items (from the list view) with and without reference -> Observe the difference;
    • Change the value of the config options and observe the difference;
    • Removing the config options shouldn't change the existing behaviour.

@bergmania bergmania merged commit e185610 into v9/feature/item-tracking Feb 24, 2022
@bergmania bergmania deleted the v9/feature/item-tracking-prevent-delete-or-unpublish branch February 24, 2022 13:07
bergmania added a commit that referenced this pull request Mar 7, 2022
* Adding TrackedReferencesController

* Adding/changing views

* Adding/Editing js files

* RelationService changes

* RelationRepository changes

* Adding missing translations

* Adding/Modifying tests

* Beginning of #9125 migration

* Introducing a new component + refactoring based on that

* Abstracting + refactoring

* Work on content unpublishing

* Work on media.delete

* Various small changes

* Beginning of #9119 migration

* Changes on content.delete

* Various fixes

* Adding new keys used in the listview bulk actions

* Adding methods to get the items used in relations from array of ids

* Adding the checkLinkedItems function to the trackedReferencesResource

* Passing the selected items from a listview to unpublish and delete

* Adding umb-tracked-references-listview

* Adding umb-tracked-references-listview-table with language column

* Fixes for tracked references

* Changes in listview unpublish dialog

* Changes in listview delete dialog

* Removing Variants logic as it is not currently supported

* Visual fixes

* Closing dialogs on click

* Fix wording

* Fix breaking changes

* Change to a single title "Items in use" instead of 2 different for Content and Media

* No need for obsoleting because we can change new controllers

* Return ActionResult from actions

* V9:  Prevent delete or unpublish of items that have references (#12047)

* Introducing config settings that prevent delete or unpublish of items referenced by other items

* Disable deletion of content items and show a new warning

* Disable deletion of media items and show a new warning

* Disable deletion of list view items

* Disable unpublish and bulk unpublish

* Add a new warning

* V9: Displaying descendants in use as part of item tracking (#12039)

* Replace HasReferencesInDescendants with GetPagedDescendantsInReferences

* Display descendants in use on parent's info tab

* Add getPagedDescendantsInReferences to trackedReferencesResource

* Add lang keys for Descendants in use

* Refactoring controller actions

* Don't call check descendants usage when it is a new item

* rename busfy to busy

* always show references

* rearrange for scrollbar to appear at the edge of the dialog

* use the word referenced instead of used

* change fallback texts

* Added "IsDependency" to relation types

* refactor of umb-tracked-references

* rename checkLinkedItems to getPagedReferencedItems

* rename check to load, to be consistent with the rest.

* Refactored backend . Needs frontend fixes

* Cleanup

* Use filters

* Front-end refactor to match refactored end-points

* Fixed bug + warning

* Fixed query (more then 2100 descensdants) and optimized it (using nested select instead of inner join).

* remove comment

* hideNoneDependencies including varying text for the configuration

* Hack for SqlCE :(

* some final adjustments for item tracking ui

* Unbreak change

Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
Co-authored-by: Bjarke Berg <mail@bergmania.dk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants