Comments

darrell_ulm’s picture

Title: User signature does not appear in comment preview » User signature does not appear in comment preview - patch sent
Status: Active » Needs review
StatusFileSize
new989 bytes

OK, here is patch.

Attached and produced what is below. If anything is odd, let me know so I can correct.

---
 core/modules/comment/comment.module |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 7ad14e8..64d74ce 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1896,6 +1896,8 @@ function comment_preview($comment) {
     if (!empty($account->uid)) {
       $comment->uid = $account->uid;
       $comment->name = check_plain($account->name);
+      $comment->signature = $account->signature;
+      $comment->signature_format = isset($comment->signature_format) ? $comment->signature_format : NULL;
     }
     elseif (empty($comment->name)) {
       $comment->name = variable_get('anonymous', t('Anonymous'));
-- 
1.7.4.1

Niklas Fiekas’s picture

Title: User signature does not appear in comment preview - patch sent » User signature does not appear in comment preview
Status: Needs review » Needs work

Well done, this fixes the problem. Only this way the signature format is ignored. Try using "Filtered HTML" in your signature and look at the result.

I'll also write a test now.

Niklas Fiekas’s picture

Status: Needs work » Needs review
StatusFileSize
new2.13 KB
new1.54 KB

Ok. Here's the test. We're expecting that to fail.

Also, with your starting point, it wasn't hard to improve the fix. We're expecting the combined patch to pass.

bleen’s picture

Status: Needs review » Needs work
+++ b/core/modules/comment/comment.testundefined
@@ -866,8 +866,14 @@ class CommentPreviewTest extends CommentHelperCase {
+    $edit['signature[value]'] = '<a href="http://example.com/">Test signature</a>';

This is a fairly minor point, but we usually use $this->randomName(8) for text like this and then we test for that random string later. This garuntees that we dont find the string "Test Signature" somewhere else on the page for some (unlikely) reason.

Just make sure you set a variable with the random string so you have something to assert later....

-22 days to next Drupal core point release.

Niklas Fiekas’s picture

Status: Needs work » Needs review
StatusFileSize
new2.18 KB
new1.59 KB

Ok, thanks for reviewing. Here's a reroll with randomName() instead of that magic string.

darrell_ulm’s picture

Niklas,

Thank you. Yep, you make a good point. Want to get back to this when I have a sec.

darrell_ulm’s picture

Niklas, Cool, way to go!

darrell_ulm’s picture

Patch applies & tests OK.

-Darrell

darrell_ulm’s picture

Status: Needs review » Reviewed & tested by the community

Tested this, I needed to change the status to "reviewed & tested by the community."

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: +Needs backport to D7

Makes sense. Committed/pushed to 8.x, moving to 7.x for backport.

Niklas Fiekas’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new2.14 KB
new1.57 KB

Thanks. Here is a cherry-picked backport.

darrell_ulm’s picture

Status: Needs review » Reviewed & tested by the community

Tested 7.x backport. Patch applied and working.

darrellulm

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Hm. I guess there's a small chance this could break themes that aren't expecting it, but OTOH this feels like a straight-up bug fix.

Committed and pushed to 7.x. Thanks!

darrell_ulm’s picture

Cool. Thanks for the assist @Niklas Fiekas + 1

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