Closed (fixed)
Project:
Drupal.org infrastructure
Component:
Git
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
1 Nov 2013 at 17:37 UTC
Updated:
21 Aug 2014 at 21:00 UTC
Jump to comment: Most recent, Most recent file
This is default behavior in D7 after #26966-153: Fix comment links when paging is used..
In D6, the #4 links next to each issue comment included the URL like node/X#comment-Y. Now, they just look something like this:
https://drupal.org/comment/8133955#comment-8133955
That causes some problems:
Workarounds
Potential solutions:
I put what seems to be the most popular solution at #1. Solutions #2 and and #3 would need to be done if #1 isn't.
Advantages of node/123#comment-456 format:
Disadvantages of node/123#comment-456 format:
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | project_issue-2125397-21-comment-permalinks.patch | 1.2 KB | ianthomas_uk |
Comments
Comment #1
gregglesIMO, Druplicon should be fixed.
For the [#x] filter, people should get the nid from somewhere else than the url.
Comment #2
dwwOh right, in IRC greggles reminded me that links such as https://drupal.org/comment/8133955#comment-8133955 are a feature when an issue has so many comments that they're being paged. :/ So that's the "solution" to #268374: "Jump to" links are broken on multi-page issues.
Not sure what to do now. I still think we want the nid in an easy-to-find place that you can cut and paste. And Druplicon should be fixed (not sure where/how). And maybe we should actually leave the anchor links as-is.
Comment #3
joachim commentedWill the old URLs work?
In the workflow I use for projects, if I have to patch a contrib module, I give the URL to the comment that has the patch in the git commit message for my project's repository.
So I have a lot of existing commits with the old URLs in various projects.
(Details are reasoning here: https://github.com/joachim-n/git-house-guidelines#patching-contrib-modules)
Comment #4
gregglesI propose putting the nid at the end of the h1 tag so they are easy to copy/paste.
Comment #5
joachim commentedAh yes, the old URLs work. That's good.
The new format is not as nice, as you don't see the node ID in the URL.
(It's also a bit silly: why does the comment ID need to be repeated in the URL?)
Comment #6
tim.plunkettThis has caused me the most problems out of anything thus far.
1) Copy the URL, paste, hit TAB for dreditor... nothing happens. Because its not a node!
2) I'm on a node, but I want to link someone to the appropriate comment. Now that's a page load! Not just adding a #fragment. On mobile, this is a HUGE problem.
3) You can no longer tell which issue something is on. Combined with #2125287: Add issue metadata (besides related issues) above the comment textarea, this is really really annoying.
Comment #7
grisendo commentedWhat does search engines think about this?
There are lots of links (one per comment) in an issue linking to "other url", which in fact is the same page with an anchor. Canonical link tag in HTML head looks OK, pointing to node/X
Any SEO expert?
At least, comment references link inside comments are kept with just the anchor, so no page load is required (which is quite good, because today drupal.org had lot of chances to get 500 error messages when requesting a new URL).
Comment #8
dasjoit would be helpful to see some reasoning behind changing the comment permalinks in that way.
on the downside it confuses users and causes unnecessary page reloads when clicking on comment permalinks.
edit:
also note that after posting comments, you are still redirected to the old url structure which basically leads to a non-existant anchor tagups, the last observation might just be wrongComment #9
eliza411 commentedComment #10
vladan.me commentedShouldn't this be rather easy issue to fix, I mean if you look at code structure:
...
There is already link that we need and anchor works anyway, just replace href from
<a href="/comment/8136269#comment-8136269" class="permalink" rel="bookmark">#6</a>with value from (+ appending #)
<a id="comment-8136269"></a>So it could look something like this:
<a href="/node/2125397#comment-8136269" class="permalink" rel="bookmark">#6</a>Comment #11
dwwRe #8 from dasjo: I explained the reason in comment #2. This was a change in Drupal core itself for D7.
We could (mostly) hack around this problem in project_issue, but then we're back to the problem of comments on issues that are so huge that we trigger the comment pager.
I agree this is annoying and makes d.o harder to use. But, perhaps we're going to have to fix dreditor and the Druplicon IRC bot to know about this, keep the issue nid visible in other places, then call this issue "by design". But I'll leave this issue open for now to gather other opinions and options.
Cheers,
-Derek
Comment #12
joachim commentedThe list of issue files has links to comments which do include the node ID, since they're intended to jump further down on the same page.
So at least my git workflow is okay, since I only ever need to link to comments where a file was uploaded.
Comment #13
klonosI really liked the old D6 way.
Comment #14
joachim commented> https://drupal.org/comment/8133955#comment-8133955 are a feature when an issue has so many comments
Slightly off-topic, but wouldn't a better fix for that problem have been for the comment rendering on nodes to have this sort of logic:
1. get given the node
2. how many comments does it have?
3. what's the comment pager set to?
4. does the requested URL have a jump link appended to it? If so, does this point to a comment that is past the first page?
5. render comments accordingly.
Comment #15
gregglesJump link information is simply not available server side.
Comment #16
webchickI'll chime in as another person whose workflow has been pretty screwed up by this change. :( Though I can't in good consciousness raise it to "major" with all of the other outstanding things.
Nevertheless, here's what's happening:
1. Find a comment I want to reference from an e-mail or whatever.
2. Click on "#44"
Old step 3: Copy/paste the URL from my browser's address bar.
New step 3: Curse and wait 10+ seconds while Drupal.org reloads the entire page I was just on at a different URL.
4. Hit the back button.
5. Right-click "#44" and copy the URL.
6. Paste it at the end of the URL in my browser address bar.
7. Manually munge it until I get the old style URL.
8. Copy/paste the URL from my browser's address bar.
:(
I have to assume that at least some of these performance issues we're experiencing are caused by these superfluous page reloads by other people trying to do the same thing.
Comment #17
gregglesComment #18
ianthomas_ukI've updated this summary with a fourth option (node/nid?page=pid#comment=cid) and added links to the core issues where these problems are being addressed. dww expressed on irc that he would rather these issues were fixed in core than worked around in project.
Comment #19
ianthomas_ukThe core issues have yet to reach agreement, and even if there is agreement soon any fix is unlikely to be accepted for 7.x, so I don't think we can just wait for it to be fixed in core.
I've put some advantages/disadvantages of the old URIs in the summary, general feeling here (which I agree with) seems to be that the old URIs were better, even if they had a problem on issues with lots of comments.
Would a patch to implement #4 (or #1) be accepted?
Comment #20
dwwYeah, you're probably right that waiting for core to fix this isn't really a viable approach. I was more expressing my general frustration in IRC than actually proposing that as a "fix" here. ;) However, I wouldn't mind working around this in a way that matches what core should be doing / will be doing in 8.x.
But sure, I'd be happy for a patch (probably against
project_issue_preprocess_comment()) that implements solution #4. That seems great to me if it works. ;)Thanks!
-Derek
Comment #21
ianthomas_ukThanks for the pointer to
project_issue_preprocess_comment, we're already messing with the permalink there so it's definitely the right place.The patch is actually quite simple. Important notes:
Comment #22
ianthomas_ukdoh!
Comment #23
sunChanging the Comment Permalink URIs in D7 certainly won't be possible at this point in time anymore. However, we will try to fix the UX regression at least for D8...
In studying the situation, I noticed that there is a module for this:
https://drupal.org/project/comment_fragment
Note sure what the d.o policy is, but it might make sense to use that module instead of custom code. Modules have an overhead, too. Really depends on the project-specific policy.
FWIW, I adjusted Dreditor to at least provide a temporary stop-gap measure until this issue is fixed:
https://github.com/dreditor/dreditor/pull/105
Comment #24
ianthomas_ukComment #25
catchThis was the fix from the Drupal 7 upgrade I was most looking forward to, and I haven't been very bothered by the comment/% paths at all.
There are very good reasons why we ended up with this scheme, and I don't see any of that discussion reflected here or at #2010202: Deprecate comment_uri().
If the issue is with copy/paste, then I'd suggest some javascript that changes the URL of the link when it's copied to include the nid (but retains the behavior on click to avoid redirects/extra queries) and possibly document.location when you visit a page. That way nothing has to change under the hood at all.
A solution that reverts or significantly waters down #6162: #new links don't work on paged threads / #26966: Fix comment links when paging is used. please no.
Comment #26
tvn commentedComment #27
drummLet's try https://drupal.org/project/comment_fragment. That will be better than maintaining this code in project_issue module.
It needs a general code review. Any potential performance or security issues? Is it something you would trust to run on your own site?
I do see some minor whitespace problems. Otherwise, it looks okay on code read. Since it is such a small module, it is possible to check that all code paths are free from PHP notices.
Comment #28
drummComment #29
joachim commentedLooks okay to me. As you say, there's a whitespace issue which makes the big complex if/else stuff at line 20 had to read (comments would help there too).
I spotted this: #2227073: Remove calls to drupal_get_path_alias(). I'm not sure if that's a performance problem, as AFAICT path aliases get cached statically.
Comment #30
sunThe situation became worse ~two days ago, created:
#2239171: Regression: "Most recent comment" jump links navigate to an entirely new page
Comment #31
drumm#2227073: Remove calls to drupal_get_path_alias() is a problem, it actually shouldn't even be called at all. I'll follow up in that issue with a patch.
That triggers a core bug, #1200478: Changing the comment path to the node path triggers a PHP fatal error in l() due to wrongly structured options.
Comment #32
drummComment fragment will also need #2239337: Add 7.x-1.x-dev release.
Once the comment fragment issues are resolved, we can deploy this. My testing shows the module otherwise works well. We can apply the core patch to Drupal.org ahead of core commit, since it looks good.
Comment #33
sunAdditional Drupal core issue to fix the secondary root cause:
#2239369: "Comments per page" setting cannot be configured to be larger than 300
Comment #34
drummThis is now ready to deploy. I fixed #2239337: Add 7.x-1.x-dev release & #2239369: "Comments per page" setting cannot be configured to be larger than 300. And #1200478: Changing the comment path to the node path triggers a PHP fatal error in l() due to wrongly structured options has been committed to our BZR repo.
Comment #35
drummNow deployed & enabled.
Comment #36
yesct commented<3
Comment #37
andypostThis adds a big query execution for each comment render, are you really sure??
Comment #38
drummThat's in project_issue module, not here. #268374: "Jump to" links are broken on multi-page issues would be the issue to re-open. But, only with specifics, not being unsure. We've been running that patch in production for about a week already.