Needs work
Project:
Drupal core
Version:
main
Component:
comment.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Dec 2009 at 16:34 UTC
Updated:
4 Feb 2023 at 19:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
peximo commentedThe problem seem to be that in comment preview there isn't the
$comment->cidused intemplate_preprocess_comment()to create the link.$variables['title'] = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => "comment-$comment->cid"));Comment #2
dawehnerI guess the only way to "solve" this is to show no link, if the cid is not available.
Comment #3
peximo commentedThis patch fix the problem; obviously the subject appearance in the preview is different than that in the node view.
Comment #4
dawehnerUpdate status
Comment #6
peximo commentedSet the right unix format.
Comment #7
MichaelCole commented#6: comment_subject-655410-6.patch queued for re-testing.
Comment #9
peximo commentedI don't think we need to modify
comment_uri(). Rerolled.Comment #10
retester2010 commentedtrailing white space
Powered by Dreditor.
Comment #11
peximo commentedRerolled.
Comment #13
peximo commentedUpdated and rerolled.
Comment #15
peximo commentedComment #16
rschwab commentedThe patch still applies to latest dev, fixes the problem, and adheres to coding standards as I understand them. dereine do you agree this is RTBC?
Comment #17
webchickTests please.
Comment #18
Tor Arne Thune commentedI can still reproduce this using Drupal 7.2.
Comment #19
dawehnerThis code should better be explained here.
In general the solution in #1048494: No title or wrong title in preview should be synced with this one, even it's not 100% sure which one is the better one.
Comment #20
andypostComment #21
kerby70 commentedCurrent Drupal 8.0.x-dev comment.module code creates the preview title link to front. Does this resolve this issue for D8?
Comment #22
andypostI think it makes sense to provide a real link when comment not new (when preview called for edit comment form)
And yes this needs tests and total rewrite because code is changed
Comment #23
larowlanWhy not make the link to #? i.e. remain in the preview
Comment #24
andypostGood idea, comments in preview always have #new marker, so here's a new patch
Let's see the tests coverage
Comment #25
andypostComment #26
kerby70 commented#24 looks great. Both links remain on the current page form the comment preview page.
I am updating the summary for better clarity.
Comment #28
alexpottStill needs tests
Comment #29
lakshminp commentedadded test case.
Comment #30
andypostplease file a separete patch with test only to make sure that test fails without patch
Comment #31
lakshminp commentedpatched with just the test alone.
Comment #32
andypostLet's see
Comment #34
andypostso "fail" is valid, please name the patch next time "patch_name-fail.patch"
Comment #35
xjmThanks for the test-only patch and the clear issue summary!
I thought we added something that made links in previews not take the user out of the preview a long time ago... I guess it was only the node preview. Since then the "real" preview functionality has improved it further and does this:

I agree with fixing this the "quick" way for now as it improves the usability slightly; linking to the front page is definitely wrong. In another issue though, we should explore using the same preview mechanism we have for nodes. Maybe for 8.1.x, though as a usability improvement it might even be acceptable for 8.0.x.
However, I don't think the approach in this patch is correct. When I preview a comment, the
#newfragment ID does not even appear on the page, so they are just broken no-op links. It might as well be a link to#. Also, there are still other links on the page that can take the user out of the preview, like the username link, or any menu item for that matter since it's not considered an admin path the way that node preview is.Maybe for an interim fix we should dig out the earlier patch for node preview links and use that fix -- I think it added some javascript or something to make all the links on the whole preview page not do anything? Failing that, I'd prefer to just link to
#rather than a non-existent fragment ID. But let's at least try to find the previous issue and add it to the related issues.Less important, but this comment confuses me a little. "Comment could not be saved now" doesn't seem correct. Maybe "Use the current page for the title and permalink in the preview, so that the user does not accidentally leave the page and lose work."
Minor: missing period at the end of the comment.
Comment #46
larowlanComment #47
lendudeRerolled and refactored, we are changing two links, so expanded the test coverage to cover both.
Since @xjm pointed out that this wasn't the best way of fixing this, not sure how valid this still is.
Comment #48
rinku jacob 13 commentedI have successfully applied patch #47 for drupal 9.4.x-dev. thanks @Lendude
Comment #51
smustgrave commentedHoly cow 13 years...
Testing on Drupal10.1 I can confirm the issue is still there. The subject link goes to the homepage which just doesn't make sense.
Applying the patch from #47 the link is now #new which is MUCH better.
Triggering D10 tests
If those pass I'll mark it.
Comment #52
smustgrave commentedSeems to have test failures that are valid.