I often find myself copying and pasting links to other issues, and most times just to mark an issue as duplicate of another issue. However, I need to manually edit the pasted issue URL for the project issue link filter, because that accepts

[#123456789]

only, but does not support the full URL, i.e.

[#http://drupal.org/node/123456789]

So, each time one needs to go backwards and delete everything before the issue number, which becomes quite annoying over time.

Attached patch is draft, which I would finish if I knew whether this patch would be accepted at all.

Comments

dropcube’s picture

I strongly support this. You see everywhere in the issue queue links to related issues, yes, they are converted to clickable links, but the link with the node number does not say nothing about the status of the other issue. It is very confusing.

Seems that the developers does not have time to use the current format #12345: How do I log in as admin?, so consider improving the URL filter for both, usability and readability of the issue tracking.

aclight’s picture

Have you tested this patch at all? I haven't, and I wonder if the final output will be right, considering that the text in question will be going through the URL filter and then the project_issue issue nid filter (in that order, I believe). It seems that the <a> tags might get put in twice, and mess up the final output.

Also, I'm not sure that this is really a good idea in the first place. What about sites that use different paths than node/nid#comment-cid, assuming that's possible? In addition, will your regex work with sites that have Drupal installed in a directory called node (this probably isn't likely to happen, but you never know)?

sun’s picture

Hm. Maybe you're right in that this might be too specific for other implementations of project_issue.

So I thought about alternatives - and the most simple one would be to not alter the input filter at all, but add separate input filter to drupal.org that checks each URL, which starts with http://drupal.org/node/ for whether it is a project issue, and transforms it the same way as project issue's filter is doing.

From my experience this would not be a big difference - most links to drupal.org in issue follow-ups point to other issues anyway. Only a marginal small amount of links point to handbook pages that do not have an URL alias (bear in mind that only paths beginning with 'node/' would be transformed).

dropcube’s picture

Yes, I was thinking mainly in the drupal.org issue tracking system. Anyway, can get the URL and obtain the normal path of the path it represents ?

dww’s picture

Priority: Normal » Minor

I fail to see the usability problem here. What's so hard about just selecting the nid and pasting that? In my browser, I go up to the URL bar, mouse over the nid, double click, and that's it. The issue where this format was added (#89673: GHOP #53: add input filter to convert #12345 into an issue link) was very long and complicated, since it was hard to get even the current behavior working properly (and it's still got some edge cases it doesn't fully handle). I'm not really psyched about trying to alter it much just because some developers haven't figured out how to only select a nid and not a full URL.

Seems that the developers does not have time to use the current format

Uhhh... ? Do you have any evidence to support that claim? I don't have any hard proof myself, but I'd bet $20 the problem is not that they "don't have time", the problem is most people don't know about this since they didn't hear about it when we announced it and never bothered to read the fine print on the "Filtered HTML" input format help text.

aclight’s picture

I don't have any hard proof myself, but I'd bet $20 the problem is not that they "don't have time", the problem is most people don't know about this since they didn't hear about it when we announced it and never bothered to read the fine print on the "Filtered HTML" input format help text.

I agree that this is probably the reason in most cases.

The one advantage I see for doing something like what's in the patch is that links to other issues that were created/posted before the issue nid link filter existed would then also be converted to show the issue nid, title, and status (on mouse over of the link), and that would be nice.

However, as the mentor to the GHOP student who created this filter in the first place, there were quite a few problems with getting it to work right, and I would hesitate to go messing with something that works well.

If we did this, I do feel that doing it in the drupal.org module would be preferred to doing it in project_issue, but others may disagree. In any case, as dww pointed out this would need to be thoroughly tested by someone locally using the drupal.org installation profile, and then tested on project.drupal.org before being deployed.

<honesty>
I don't think I actually knew that double clicking just the nid in the URL would select just that part of the URL. I usually either copied the whole thing and deleted the rest, or manually selected the nid by click-dragging over it.
</honesty>

sun’s picture

Title: Usability: Improve project issue link filter » Usability: Add project issue URL filter
Project: Project issue tracking » Drupal.org customizations
Version: 5.x-2.x-dev »
Component: Miscellaneous » Code
Priority: Minor » Normal
Status: Needs review » Needs work

Well, this is quite related to #310446: Remove issue creation links from project pages. If I wouldn't have to maintain a bloat of projects in contrib and mark several issues a day as duplicate or cross-reference them for interest (approx. 10 per day), then I wouldn't care either.

However, in the current state, it's a mess to copy for example http://drupal.org/node/304808#comment-1020976, go back to the other issue, insert [#, paste http://drupal.org/node/304808#comment-1020976, delete #comment-1020976, move back, delete http://drupal.org/node/, and add ] for each issue I want to point to.

As mentioned in #3, the most easiest way would be to add an input filter that converts regular URLs if they point to issues.

catch’s picture

I'd love this - I often forget that [#http://drupal.org/node/304808] doesn't work and have to go in and edit my followups, which is annoying (I'd also support that syntax if it's easier than processing just straight urls - saves a click or two compared to selecting or deleting the rest of the URL.

There's an existing issue for the core url filter processing generated URLs, but it's long and ugly.

greggles’s picture

Compare the workflows:

Proposed:
1. ctrl+l (command+l if you prefer)
2. ctrl+c
3. [# ctrl+v ]

Current:
1. Pick up mouse
2a. Focus it over just the nid and doubleclick (note that this doesn't work in Firefox, which is the most common browser on drupal.org, nor in Opera)
2b. Click, move mouse to beginning of nid, release click
3. ctrl+c
4. [# ctrl+v]

Current for keyboarders:
1. ctrl+l
2. end OR right-arrow
3. shift+ctrl+left-arrow
4. ctrl+c
5. [# ctrl+v ]

In other words...+1 on the concept.

aclight’s picture

2a. Focus it over just the nid and doubleclick (note that this doesn't work in Firefox, which is the most common browser on drupal.org, nor in Opera)

It works for me in FF2 and FF3 on Windows and Mac.

dropcube’s picture

The problem is most people don't know about this since they didn't hear about it when we announced it and never bothered to read the fine print on the "Filtered HTML" input format help text.

That's true, but I don't think this is the generality. You often see on the queue posts from well known developers where they just paste the full URL, even knowing that the filter exists. So, let's consider an improvement to the current filter or adding a new one to convert regular URLs if they point to project issues.

sun’s picture

You often see on the queue posts from well known developers where they just paste the full URL, even knowing that the filter exists.

+1 This was also my consideration for changing the scope, goal and project of this issue.

Do others agree as well? If so, I'd volunteer for creating a patch that implements a new input filter, which does the same as the project issue filter, but parsing regular URLs instead of an inline macro.

patcon’s picture

Assigned: sun » Unassigned

Proposed:
1. ctrl+l (command+l if you prefer)
2. ctrl+c
3. [# ctrl+v ]

Isn't the proposal that you can just paste the link to an issue and it will convert? I thought that the people mentioning [#http://drupal.org/node/304808] were simply referring to the mistake that's often made... wouldn't filtering the direct link be simpler if possible?

Great idea, by the way!

TEST: http://drupal.org/node/304808
#304808-9: Usability: Add project issue URL filter

dww’s picture

@sun: If you wanted to work on a patch for project_issue that supported raw URLs, noticed if they were on the local site, looked up the nid, saw if it was an issue, and if so, converted to the same format as the existing filter, I'd be happy to review and test it, and if it's not terribly insane, commit it. For extra credit, if the link anchor includes a comment number (e.g. http://drupal.org/node/304808#comment-1022088) that should get converted into #304808-5: Usability: Add project issue URL filter (like we do now when you write #304808-5: Usability: Add project issue URL filter to refer to a specific comment within the issue). I'm just concerned that making this really work right is going to be a bit of a nightmare, which is why I'm reluctant to work on it myself. But, if you feel strongly, I promise to work with you to try to get the code in committable shape and deployed...

sun’s picture

Assigned: Unassigned » sun

I don't have time now, but I'll be able to work on this after freeze.

dave reid’s picture

Assigned: Unassigned » sun

Looking forward to this! Thanks ahead of time to sun.

hass’s picture

+

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new3.5 KB

Here's my initial effort at this. Did not want to use lots of regex.

dave reid’s picture

Project: Drupal.org customizations » Project issue tracking
Version: » 6.x-1.x-dev
Component: Code » Issues

Moving this to project_issue since it can be re-usable not just on drupal.org.

dww’s picture

Status: Needs review » Needs work

Thanks for moving this forward!

A) Looks like this is still only allowing [#http://drupal.org/node/304808] style references, not just http://drupal.org/node/304808 -- is that intended?

B) At first glance, this seemed like a bug:

     case 'process':
       $regex = '(?:(?<!\w)\[#\d+(?:-\d+)?(@)?\](?!\w))|<pre>.*?<\/pre>|<code>.*?<\/code>|<a(?:[^>"\']|"[^"]*"|\'[^\']*\')*>.*?<\/a>';
       $text = preg_replace_callback("/$regex/", 'project_issue_link_filter_callback', $text);
+      $text = preg_replace_callback('/(?:(?<!\w)\[#(.*)](?!\w))/', 'project_issue_link_abs_filter_callback', $text);
       return $text;

It'd be helpful to add a code comment here explaining that we're not actually clobbering $text with the 2nd line, we're only touching it if the first one didn't find anything with just [#nid] and we do find something via [#url].

C) There's an awful lot of duplicated code between project_issue_link_abs_filter_callback() and project_issue_link_filter_callback() :( It'd be nicer to refactor those into a shared helper that actually renders the junk once we have a nid and cid, and then each function can just be responsible for processing the text based on the regexp that matched to find the nid (and cid) we're dealing with.

claar’s picture

yesct’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes

7.x now?

Would this work for change records, projects, doc page, users?

I think this will not help with api #870074: Add a filter to link to api.drupal.org or g.d.o links.

yesct’s picture