All places in Comment module should replace global $user and $GLOBALS['user'].

Files: 
CommentFileSizeAuthor
#34 2061899-34-global-user-comment.patch4.69 KBjoelpittet
PASSED: [[SimpleTest]]: [MySQL] 59,353 pass(es).
[ View ]
#32 2061899-32-global-user-comment.patch4.66 KBjoelpittet
PASSED: [[SimpleTest]]: [MySQL] 59,052 pass(es).
[ View ]
#19 2061899-19-global-user-comment.patch3.7 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2061899-19-global-user-comment.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#19 interdiff.txt5.39 KBjoelpittet
#18 interdiff.txt1.59 KBjoelpittet
#18 2061899-18-global-user-comment.patch3.7 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] 60,004 pass(es), 4 fail(s), and 0 exception(s).
[ View ]
#16 2061899-16-global-user-comment.patch6.84 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] 58,760 pass(es), 14 fail(s), and 0 exception(s).
[ View ]
#16 interdiff.txt1.59 KBjoelpittet
#13 2061899-13-global-user-comment.patch6.84 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] 58,410 pass(es), 14 fail(s), and 0 exception(s).
[ View ]
#11 2061899-11-global-user-comment-reroll.patch2.64 KBjoelpittet
FAILED: [[SimpleTest]]: [MySQL] 58,788 pass(es), 6 fail(s), and 0 exception(s).
[ View ]
#7 comment-remove-global-user-from-comment-module-2061899-7.patch3.54 KBm1r1k
FAILED: [[SimpleTest]]: [MySQL] 58,356 pass(es), 34 fail(s), and 0 exception(s).
[ View ]
#2 comment-remove-global-user-from-comment-module-2061899-2.patch4.31 KBm1r1k
FAILED: [[SimpleTest]]: [MySQL] 57,447 pass(es), 2 fail(s), and 0 exception(s).
[ View ]
#1 comment-remove-global-user-from-comment-module-2061899-1.patch4.31 KBm1r1k
FAILED: [[SimpleTest]]: [MySQL] 57,754 pass(es), 3 fail(s), and 0 exception(s).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new4.31 KB
FAILED: [[SimpleTest]]: [MySQL] 57,754 pass(es), 3 fail(s), and 0 exception(s).
[ View ]

Here is the patch

StatusFileSize
new4.31 KB
FAILED: [[SimpleTest]]: [MySQL] 57,447 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

Status:Needs review» Needs work

The last submitted patch, comment-remove-global-user-from-comment-module-2061899-2.patch, failed testing.

+++ b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php
@@ -225,7 +225,7 @@ public static function preCreate(EntityStorageControllerInterface $storage_contr
+    $user = \Drupal::request()->attributes->get('_account');

This is where the BCDecorator Test fails.

After debugging I fount the '_account' is not among the attributes (only parameters is available..). Not sure how to fix it, but I thought I'd post what I've found.

Looks like the ENTITY CRUD HOOKS test fails for the same reason.

+++ b/core/modules/comment/comment.module
@@ -1323,7 +1323,7 @@ function comment_load($cid, $reset = FALSE) {
function comment_num_new($nid, $timestamp = 0) {
-  global $user;
+  $user = Drupal::request()->attributes->get('_account');

Probably this one should use Drupal::currentUser()

Status:Needs work» Needs review
StatusFileSize
new3.54 KB
FAILED: [[SimpleTest]]: [MySQL] 58,356 pass(es), 34 fail(s), and 0 exception(s).
[ View ]

Status:Needs work» Needs review

+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
@@ -93,7 +93,7 @@ public function query() {
+    $user = \Drupal::currentUser();

only questionable because better to inject this service

Status:Needs review» Needs work

The last submitted patch, comment-remove-global-user-from-comment-module-2061899-7.patch, failed testing.

Assigned:m1r1k» Unassigned
Issue tags:-CodeSprintCIS
StatusFileSize
new2.64 KB
FAILED: [[SimpleTest]]: [MySQL] 58,788 pass(es), 6 fail(s), and 0 exception(s).
[ View ]

Re-rolled #7

Status:Needs review» Needs work

The last submitted patch, 2061899-11-global-user-comment-reroll.patch, failed testing.

StatusFileSize
new6.84 KB
FAILED: [[SimpleTest]]: [MySQL] 58,410 pass(es), 14 fail(s), and 0 exception(s).
[ View ]

curious about @m1r1k said in #10 so I applied both of those patches to #11 to see what testbot does.

This is a test only. Use #11 for the basis of any future patches/rerolls.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 2061899-13-global-user-comment.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.59 KB
new6.84 KB
FAILED: [[SimpleTest]]: [MySQL] 58,760 pass(es), 14 fail(s), and 0 exception(s).
[ View ]

Changed for this: #2053489: Standardize on \Drupal throughout core
Probably will still break.

Status:Needs review» Needs work

The last submitted patch, 2061899-16-global-user-comment.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new3.7 KB
FAILED: [[SimpleTest]]: [MySQL] 60,004 pass(es), 4 fail(s), and 0 exception(s).
[ View ]
new1.59 KB

I think I got some extra stuff in the last so I undid that content_translation stuff and shuffled some stuff around a bit to see if I can get some better results.

StatusFileSize
new5.39 KB
new3.7 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2061899-19-global-user-comment.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

better interdiff.

Status:Needs review» Needs work

The last submitted patch, 2061899-19-global-user-comment.patch, failed testing.

Status:Needs work» Needs review

#19: 2061899-19-global-user-comment.patch queued for re-testing.

#18: 2061899-18-global-user-comment.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, 2061899-19-global-user-comment.patch, failed testing.

18 and 19 are identical but there are two more fails:S I retested both and same diff.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 19: 2061899-19-global-user-comment.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 19: 2061899-19-global-user-comment.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 19: 2061899-19-global-user-comment.patch, failed testing.

Issue summary:View changes
Status:Needs work» Needs review
Parent issue:» #2047951: [META] Remove calls to deprecated global $user and $GLOBALS['user']
StatusFileSize
new4.66 KB
PASSED: [[SimpleTest]]: [MySQL] 59,052 pass(es).
[ View ]

Re-roll

Status:Needs review» Needs work
Issue tags:+Needs reroll

This doesn't apply anymore; it needs to be re-rolled again.

Issue summary:View changes
Status:Needs work» Needs review
Issue tags:-Needs reroll
StatusFileSize
new4.69 KB
PASSED: [[SimpleTest]]: [MySQL] 59,353 pass(es).
[ View ]

Re-rolled again.

Status:Needs review» Reviewed & tested by the community

Looks good. Passes test bot.

Status:Needs review» Reviewed & tested by the community

RTBC'd again.

Status:Reviewed & tested by the community» Fixed

Committed and pushed to 8.x. Thanks!

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.