Steps to reproduce:

  • Create a new account and log in.
  • Comment on something.
  • Cancel the account, assigning content to Anonymous.
  • See that the username is still present.

The comment table has a name column that needs to be reassigned too. Affects both D7 And D8. Setting to major since this is not ideal for privacy.

Comments

drumm’s picture

Issue tags: +Needs tests
StatusFileSize
new587 bytes
drumm’s picture

Status: Active » Needs review
jibran’s picture

Issue tags: +Needs backport to D7

if it affects drupal.org then it will be back ported.

jcnventura’s picture

Status: Needs review » Needs work

@drumm I can confirm that the patch fullfils its objective. But this needs a test.

drumm’s picture

Yep. I couldn't actually find any existing tests that looked good to extend for this. Any advice for where the test could live?

jcnventura’s picture

@drumm Funny I was going to ask you the same question :)

jcnventura’s picture

@drumm: I'm creating a new test class called CommentUserChangesTest

jcnventura’s picture

Issue tags: -Needs tests
StatusFileSize
new3.16 KB
new3.73 KB

I ended up adapting the existing UserCancelTest test

Here's the patch with tests.

jcnventura’s picture

Status: Needs work » Needs review

I keep forgetting the status..

And the funny thing is that in the tests $test_node->getRevisionAuthor()->getUsername() is 'admin' after the anonymization takes place, but that seems to be a side effect of the fact that the author is uid 0.

jibran’s picture

Awesome this looks good let's wait for bot.

The last submitted patch, 8: 2472043-tests-8.patch, failed testing.

jibran’s picture

Status: Needs review » Reviewed & tested by the community

let's fix d.o

drumm’s picture

Thanks for the tests, looks great.

Here's the D7 version, without tests yet.

drumm’s picture

StatusFileSize
new536 bytes
xjm’s picture

Version: 8.0.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed and pushed to 8.0.x. Moving to 7.x for backport.

  • xjm committed 0a1a3d8 on 8.0.x
    Issue #2472043 by drumm, jcnventura: Canceling a user account, assigning...
jcnventura’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new3.17 KB

And a fixed D7 patch with tests...

drumm’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: canceling_a_user-2472043-17.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

I tested it too. RTBC+1 from me. Resetting the status.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: canceling_a_user-2472043-17.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community
drumm’s picture

This is now deployed on Drupal.org.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review

Hm, are we sure the current behavior isn't intentional? Consider two identical sites (and assume anonymous users are allowed to leave comments):

  1. Site A:
    • President Obama is a registered user.
    • President Obama logs in and leave some comments. The comments have the name "President Obama" attached to them.
    • President Obama deletes his account and chooses the option to assign to anonymous.
    • When other users view the site, the above comments now have the name "President Obama (not verified)" attached to them.
  2. Site B:
    • President Obama never joined this site.
    • An anonymous user comes along and leaves some comments, typing in "President Obama" for the name field.
    • When other users view the site, the above comments have the name "President Obama (not verified)" attached to them.

So comparing the two sites you can't actually tell that the real President Obama was ever a member of the first one anyway. (The appearance of the "not verified" is supposed to indicate that this the comment wasn't left by a registered user, so it doesn't actually provide any identifying info - anyone could have typed that name in.)

To be more specific, the reason you might want to leave the names behind when deleting the account is to distinguish the comments on a long thread, e.g. if multiple users who commented on that thread had their accounts deleted, for sanity's sake you still want to see that the comments were left by different people.

I can see why drupal.org (which doesn't allow anonymous commenting in the first place) might rather delete these but I'm not sure it's the right solution in general. This could use some more discussion.

drumm’s picture

The cancel user UI says "Delete the account and make its content belong to the Anonymous user." That makes me think the usernames should not remain. There isn't equivalent keeping names like this for nodes.

If a site wants to keep names on content, blocking the account might be the way to go.

This came up for Drupal.org when someone who had cancelled their account contacted us asking why their name was still appearing.

jcnventura’s picture

Status: Needs review » Reviewed & tested by the community

I agree with @drumm. It is confusing to the extreme that "make its content belong to the Anonymous user", doesn't apply to all content. This should be consistent across the board.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work

"Content" is an ambiguous word - I think both interpretations are valid here, and certainly both use cases are valid.

We are talking about deleting data from the database, so I really don't think this behavior is something we can just change out from under people in the middle of a stable release. I hate to suggest adding more options to the admin UI, but since both scenarios are valid, that could be an option here - the Comment module could add a checkbox that allows the administrator to choose between the two behaviors.

jcnventura’s picture

Category: Bug report » Feature request

Agree this is not a D7 bug, but rather something slightly different from current D7 functionality.

But don't put this option in the comment module settings. This should be a form:_alter, adding that option to the user delete UI.

jcnventura’s picture

Issue tags: -Needs backport to D7

  • xjm committed 0a1a3d8 on 8.1.x
    Issue #2472043 by drumm, jcnventura: Canceling a user account, assigning...

  • xjm committed 0a1a3d8 on 8.3.x
    Issue #2472043 by drumm, jcnventura: Canceling a user account, assigning...

  • xjm committed 0a1a3d8 on 8.3.x
    Issue #2472043 by drumm, jcnventura: Canceling a user account, assigning...

  • xjm committed 0a1a3d8 on 8.4.x
    Issue #2472043 by drumm, jcnventura: Canceling a user account, assigning...

  • xjm committed 0a1a3d8 on 8.4.x
    Issue #2472043 by drumm, jcnventura: Canceling a user account, assigning...

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.