Follower of #400450: Be more graceful when editing nodes with disabled node types and #232327: Deleting node type leaves orphan nodes .

Steps to reproduce:

  1. Add couple of nodes for a particular content type with comments enabled for a content type
  2. Go ahead and delete that content type
  3. Goto node/% page of content you just created
  4. Here you will see a comment add form only with title (NO body) and you can still add comments.

Suggested solution:

Remove comment form from node view if content type of particular content type is been deleted/disabled.

Comments

sumitk’s picture

Sreenshot of comment form

tizzo’s picture

Assigned: Unassigned » tizzo

investigating this now (at the dev summit code sprint)

adixon’s picture

Sounds like a simple issue of cleanup when node types are deleted - i.e. all the variables like comment_*_ need to get removed.

On the other hand, I wonder if that's really a critical bug .. seems to me likely desirable as not, e.g. if I delete a node type and then recreate it, keeping these old settings as the new defaults seems as likely as the normal node defaults.

joachim’s picture

> Sounds like a simple issue of cleanup when node types are deleted - i.e. all the variables like comment_*_ need to get removed.

That is already taken care of in comment_node_type_delete().

tizzo’s picture

This might be kind of a 'quick and dirty' solution, but this patch hides the comment form and comment links of the node type has been deleted.

beeradb’s picture

> On the other hand, I wonder if that's really a critical bug .. seems to me likely desirable as not, e.g. if I delete a node type and then recreate it, keeping these old settings as the new defaults seems as likely as the normal node defaults.

I think expected behavior is that the settings related to that node type are completely cleared out. Although there are rare circumstances where you might want settings to persist in this situation, I think if you delete/recreate a node type the expectation is that you are getting rid of all the cruft and starting fresh.

beeradb’s picture

Looks like that patch didn't attach correctly (it's showing 0 bytes for me)... do you mind giving it another go?

tizzo’s picture

er... empty patches make the baby druplicon cry...

Retrying.

joachim’s picture

> this patch hides the comment form and comment links of the node type has been deleted.

Default behaviour is for comments to be allowed, so I reckon we should follow that.

The problem is probably down in FieldAPI, in field_attach_form().

beeradb’s picture

I'm actually wondering if this is a larger issue than just the comment form. It would seem to me the intuitive result of deleting a node type is that content of that nodes type is deleted as well. Outside of potential performance issues (which could be circumvented with a batch) of deleting all of the content of the node type on delete, Is there something obvious I'm missing that causes us to keep this data around?

If I were to approach Drupal with fresh eyes, I would definitely expect that deleting the content type would just clear out the content of that type as well. The current approach in this patch 'works' for the comment form, but every module which hooks into that node type is going to have to implement something similar. It might not be a huge deal in the case of core, but to potentially have dozens of contributed modules doing this is is pretty dirty.

hunvreus’s picture

I've actually struggled a couple times when somebody deleted a content types leaving some orphan nodes behind; is there a particular reason for these nodes to stay in?

tizzo’s picture

The issue is actually in 'comment_field_extra_fields' which calls node_type_get_types() in order to add the body field to the various types. When node_get_types loses the type the fields go away.

adixon’s picture

Priority: Critical » Normal

In the spirit of bjaspan and moshe's recent posts, i've downgraded this from critical to normal. It seems to me there is no consensus on a lot of expected behaviour when a node type is deleted, and none of the current behaviour classifies as a show stopper.

Actually, my bias is that it's not even a bug, but a feature, but I won't push that point of view.

In response to some of the last postings: leaving the nodes around when a node type is deleted is sometimes a good thing.

tizzo’s picture

Priority: Normal » Critical

@hunvreus & @beeradb - I agree, deleting the nodes would solve a number of problems we've found (see also #400450: Be more graceful when editing nodes with disabled node types & #232327: Deleting node type leaves orphan nodes)

I think we should just delete that stuff.

beeradb’s picture

Priority: Critical » Normal
Issue tags: +Needs usability review

Removing priority change from (assumed) crosspost.

I'm also tagging as needing a usability review. I'd like to get Bojhan or Roy's opinion on whether or not the content should be deleted from a usability perspective.

joachim’s picture

Priority: Normal » Critical

Let's not lose the focus on this.

This is not about deleting or not deleting nodes. This is about a broken comment form appearing -- I would say that is critical.

tizzo’s picture

Priority: Critical » Normal

Yeah, having a real answer to what to do with type deletions would be great.

If we keep the content we probably need to have node_get_type_names (and all of the related functions) also check the db for types to keep this and other things from breaking.

(Sorry about the severity bump before, that was sloppy.)

tizzo’s picture

Priority: Normal » Critical
Status: Active » Needs review

Argh, that was posted while I was typing, bumping back to critical.

beeradb’s picture

There's a good bit of crossover with #874000: Automatically remove module's nodes upon module uninstallation on this. I would argue that we should take the same approach whether the node type was created by Drupal core, or provided by another module.

The comment form is the 'critical' part of this, but I still feel like there's a meta-issue at play here.

Anonymous’s picture

Status: Needs review » Needs work

It seems like this issue needs work?

The last posted patch doesn't follow Drupal convention according to comment #9.

> this patch hides the comment form and comment links of the node type has been deleted.

Default behaviour is for comments to be allowed, so I reckon we should follow that.

dries’s picture

Priority: Critical » Normal

I don't think this is a critical. If you delete the node type, hell breaks loose. That's always been the case and not something we need to protect against. If that is something we want to fix, we need to fix 12 other things that go wrong when you delete a node type.

cyberschorsch’s picture

Nevermind about my comment here

sumitk’s picture

There is a similar issue here #890128: Comment body missing if comment module enabled after a content type module .. posted a patch for it but still this issue is not fixed.

tizzo’s picture

I posted a patch at #232327: Deleting node type leaves orphan nodes that prevents you from deleting a node type if there are nodes in the db, that could prevent this issue from arising.

halstead’s picture

dqd’s picture

Version: 8.x-dev » 7.x-dev

I can reproduce this with any type of content and its NOT ONLY keeping comments BUT ALSO titles of all nodes. Apart from others I think THIS is critical from a editorials point of view! Deleted content types should lead to only ONE of 2 possible solutions:

- keeping content and moving it with fitting fields to another content type
- or deleting really ALL of the nodes, plus relating fields and subs

WHY? Because: what do I need empty content items with titles and comments for, after the decision to delete corresponding content type? If the content item still would be there completely, then ok. But who has the time to manage 150 empty items manually under content administration, because you CAN'T even filter them no more by type to edit them all together!)

I have opened another issue for this (http://drupal.org/node/1151540), because this is a general bug with database handling while deleting content types.

dixon_’s picture

Version: 7.x-dev » 8.x-dev

If we would fix this, it would definitely be fixed in 8.x first.

Bojhan’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: -Needs usability review +Usability

I dont see a recent screenshot or patch?

mgifford’s picture

Assigned: tizzo » Unassigned
Issue summary: View changes

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Version: 8.9.x-dev » 7.x-dev
Issue tags: +Bug Smash Initiative

On Drupal 8.9.0, and using the steps to reproduce in the IS I was not able to reproduce this problem. I installed the standard profile and used devel to generate 50 nodes with comments. Then went to delete the article content type. The failed with

Article is used by 52 pieces of content on your site. You may not remove Article until you have removed all of the Article content.

. Then I deleted all the content of type article and when navigating to any of those nodes ids I got a page not found. All the comments were deleted as well.

I tested again on Drupal 7 and this problem exists in Drupal7, changing Version.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.