Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
comment.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Dec 2014 at 22:22 UTC
Updated:
13 Mar 2015 at 13:34 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #1
larowlanComment #2
pingers commentedIs this what you had in mind @larowlan?
Comment #3
jespermb commentedHi,
I also came up with a solution for this.
Comment #4
jespermb commentedChanged status to need review.
Comment #7
jespermb commentedReworked the patch a bit.
Comment #8
larowlanPatch at #2 is the right approach thanks @pingers (and hi by the way - hope you'll be in Melbourne in March)
Comment #10
penyaskitoWhy admins should not be able to edit?
Comment #11
larowlanThe should be able to edit for anonymous users, but not for authenticated users, the email there is a property of the user
Comment #12
piggito commentedHi,
I used SimplyTest to test the patch at #7.
First, I created a Basic Page node with the admin user. Then, I created an "authenticated user" called "test". As the "test" user, I commented on the node. Then, I got into the comment edition form using the admin user as shown in the following screenshot.

This screenshot depicts the email field disabled. Therefore, I tried to force an email variation by directly modifying the HTML (as shown in the next screenshot) but it wasn't modified in database after submit.
Finally, I changed the author of the comment using the "Authored by" autocomplete field and the email did change this time to the email of the new author (shown in the following screenshots).
Comment #14
pingers commented@piggito see comment #8. I don't think the patch you're testing is the right one. Thanks.
@larowlan I will indeed be in Melbourne :)
Comment #15
sidharrell commentedthis is pinger's patch from #2. Just re-enqueueing it here at the top of the file list so it's clear which one to test with.
I applied it, went through the test steps, and the email field is gone, see screenshot.
Comment #16
sidharrell commentedComment #17
larsmw commentedWould it make sense to disable the field, so the admin can still view the email of the user?
Comment #19
Swarnendu-Dutta commentedCreated a patch..please review..
Comment #21
Swarnendu-Dutta commentedComment #22
pingers commentedIf we disable email(#disabled) and still allow an administrator to change the comment owner, the email address does not change. You will see the previous comment owner's email address when editing the comment owner. This feels wrong to me. On these grounds, I think we should go with my original patch and hide the email address for authenticated comments (via #access).
Currently, the original commenter's email is still stored if you only change the user name (in comment_field_data.mail). But, at least if we hide the email from UI for authenticated comment, changing the owner of a comment makes sense in the UI.
@Swarnendu-Dutta
Using #attributes to disable a field means the value can still be updated via Javascript and will be saved. Should use Form API #disabled.
Changing name is out of scope of this issue.
This is wrong for the same reason as above, should use Form API #disabled.
Also, disabling the email field for administrators under all conditions is wrong. We only want to prevent changing the email of comments owned by authenticated users.
Comment #24
Swarnendu-Dutta commented@pingers, So can we use readonly here ??? i know it can be exploited through firefug but atleast the admin wont be able to edit through the UI..
Comment #25
pingers commented@Swarnendu-Dutta "Admin should not be able to edit email of authenticated commenters".
Read-only very much applies in this case... or not at all. This issue is creeping in scope and making a simple change complex.
Let's close it out... patch from comment 2 still stands in my mind. Just needs review.
Comment #26
Swarnendu-Dutta commentedComment #27
sidharrell commented#2 looks good to me. Has passed all the manual testing I threw at it. Also seems to make the most sense UIX-wise. If the email field remains in the UI, it leads to a user expectation that it could be changed here. I don't think there's a good argument for leaving the field there as non-editible, since the author is still there, identified by username, adding a re-identification by email doesn't seem to add anything to the UI, and just clutters it unnecessarily, in my opinion.
Comment #28
alexpottWe should have a test for this and also if #2 is the patch to go for then is needs to be re-uploaded since the rtbc retest only tests the last patch on each issue.
Comment #29
Swarnendu-Dutta commented@alexpott,
Re-uploaded and setting this to RTBC.
Comment #30
alexpottStill needs a test.
Comment #31
geertvd commentedComment #33
mohit_aghera commentedUpdated comment email field access settings based on settings specified in content type settings.
Comment #35
geertvd commentedThanks for adding that.
I guess we can just set that setting with
$this->setCommentAnonymous('2');since we really need that contact information for this test.Then these lines can be removed:
Looks like you forgot to add the updated test in the complete patch also
Comment #36
sidharrell commentedadded the updated test from #32 and the idea from #35.
Comment #38
mohit_aghera commentedI think
$this->setCommentAnonymous('2');should be above
$anonymous_comment = $this->postComment($this->node, $this->randomMachineName());Comment #39
geertvd commented$this->setCommentAnonymous('2');should be above$anonymous_comment = $this->postComment($this->node, $this->randomMachineName());like #38 is saying.What's happening here? I don't see this variable being used anywhere.
Best to always add a failing test and the complete patch.
Comment #40
mohit_aghera commentedUpdating the patch as per the comment and moving as per #38
Comment #41
mohit_aghera commentedComment #44
mohit_aghera commentedChanging patch and adding admin login for setting comment anonymous setting.
Comment #45
mohit_aghera commentedComment #48
geertvd commentedJust missed adding the contact info while posting the anonymous comment. This should fix it.
Comment #49
geertvd commentedComment #51
Thomas Willemsen commentedI followed the steps.
Looks good (e-mail of logged in user can't be changed by admin - for an anon user it still can be changed).
Comment #52
Bojhan commentedSo there is no argumentation in this issue? Other than an opinion, that it shouldn't. Is it legally their property? Are people actually not allowed to do this?
Comment #53
larowlan+1 rtbc, bohjan, this was a regression
Comment #54
sidharrell commented+1 rtbc
@Bojhan the admin can change the author here, and they can go into the author's account and change the email address there. I think the point is you don't want the author's email editable here cause it makes it ambiguous. If you edit it here, is it editing it just here, or will that change also show in the author's account? From UIX, it's cleaner, with a single connection, comment-to-author(by name), rather than 2 redundant connections, comment-to-name and comment-to-email.
Comment #55
alexpottThis issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 5430ac9 and pushed to 8.0.x. Thanks!