OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

proposal: cascade delete taxonomy -> terms #8736

Open MatteoPiovanelli-Laser opened 8 months ago

MatteoPiovanelli-Laser commented 8 months ago

When deleting a taxonomy, all terms in it should also be deleted: these operations should probably be "gated" by checks to make sure references in the system don't break.

Example of what I have in mind. image This is a screenshot of a taxonomy in a tenant on my dev box. When I hit delete:

cc @sebastienros @HermesSbicego-Laser

sebastienros commented 8 months ago

Sounds good

BenedekFarkas commented 2 months ago

Can this

'OnRemoving()' it should check whether the term is selected in any TaxonomyField: if that is the case, the depending on a setting on the ContentType for the term, the operation may fail.

be true if the parent Taxonomy is not selected for a field?

MatteoPiovanelli-Laser commented 2 months ago

be true if the parent Taxonomy is not selected for a field?

yes, it may be true even if the taxonomy is not selected for a field. For example, in the case of a tenant with multiple Cultures, in the definition of a TaxonomyField you' likely select the taxonomy in you main culture; if later you delete a translation of that taxonomy, you may find its terms have been selected in fields whose "selected" taxonomy is a different one. I can't guarantee that's the only case, but that's one off the top of my head.

BenedekFarkas commented 2 months ago

I see, thanks! I had a hunch it has something to do with translations, especially since you suggested it. :)