Plugin config: Delete entity along with GroupContent

Created on 23 June 2016, over 8 years ago
Updated 24 June 2024, 3 months ago

Add two checkboxes to plugin config:

  • Delete the entity along with the group-entity relation (GroupContent)
  • Only delete when the entity is not part of any other group

Then implement those.

πŸ“Œ Task
Status

Needs review

Version

3.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium msnassar

    Here is a patch for group 2 and 3...

  • πŸ‡§πŸ‡ͺBelgium msnassar

    The patch in #15 is working for our website as we do not allow sharing content between groups.

    Anyway, the proposed solution, is good when:

    • Content is not shared at all
    • Content is shared between same group type
    • Their is no conflict in the delete settings -for the same relation plugin- in the multiple group types

    But, I wonder what should happen in case an entity is shared between 2 groups of different group type; where the relation plugins in each group type has different settings for entity deletion. For example:

    • Having group type A and group type B
    • Enable the relation plugin for Page content type in both A and B group types
    • In group type A: The configs for the plugin is > "Delete target entity when group relation is deleted" (So we always want to delete - No matter if the entity is being shared or not.)
    • In group type B: We keep the default > Do not delete the entity (The option do delete the target entity is not selected).
    • Create 2 groups: Group X of type A and Group Y of type B
    • Create a page node in group X and share it with group Y
    • 1. If the user deleted the relation in group X, the node will be deleted
    • 2. If the user deleted the relation in group Y, the node won't be deleted

    Case #1:
    It is deleting an entity that is being shared with other group (of different type) that assumes an entity should not be deleted when deleting its relation.

    I think we should have a third option e.g. "Only delete when all same relation plugins in other group type allow to delete".
    When this option is selected, Case #1 won't delete the target entity as it is being shared with a group of another type that prevents deleting the target entities!

  • πŸ‡ΊπŸ‡ΈUnited States maskedjellybean Portland, OR

    Here's a version of the patch for Group 1.0.x (tested on 1.6.0) that combines the patch from #12 with the patch from #3 of this issue: https://www.drupal.org/node/3364703 β†’

    The two are unrelated, but since they touch the same code, you can't apply both at once. This is likely something that only a few people would run into and probably frowned upon by maintainers, but uploading anyways. All this does differently from #12 is reload the entity in order to check that it still exists before saving. Strangely the code comments around line 216 of GroupContent.php imply that this is already happening, but it's clearly not.

Production build 0.71.5 2024