Closed Bug 549586 Opened 15 years ago Closed 14 years ago

"See also" field should parse bug numbers from the local bugzilla installation as valid

Categories

(Bugzilla :: Creating/Changing Bugs, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: thomas8, Assigned: timello)

References

(Blocks 1 open bug)

Details

(Whiteboard: [es-redhat])

Attachments

(2 files, 3 obsolete files)

STR User wants to include a link to another bug from the same installation (say bmo): - the other bug has some relevance for the current bug - but it's neither a duplicate, nor dependent, nor blocking. I often find that I need to add links to such just somehow "related / relevant" bugs within bmo. Actual result: a) you have to enter *full bug URL* of related bug from same bugzilla installation into "See also" field, like this: See Also: [https://bugzilla.mozilla.org/show_bug.cgi?id=55436, ...] b) after committing, a linkified version of the *full bug URL* will be displayed in "See Also" Field, like this: See Also: _https://bugzilla.mozilla.org/show_bug.cgi?id=55436_ Given the fact that the linked bug is from the same installation: - that's very cluttered with information you don't need (the full path), - and lacking tooltip information you *do* need (the bug's title, status etc.) Expected result: a) Allow entering plain bug numbers from same installation into See Also field (in addition to full URLs), like this: See Also: [55436, http://somewhere_else.com/external_link.htm, ...] b) parse / auto-linkify bug links from local bugzilla installation, like this: See Also: Bug 55436, http://somewhere_else.com/external_link.htm, ... (with or without the word "Bug" in front of the bug number) This requires parsing the following - plain numbers (e.g. 55436) - full URLs from local installation (e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=55436) -> both of these should be displayed autolinkified like this: See also: bug 55436 (with or without the word bug in front of it) Technically, should be simple: Step1: comma-split the string with values from "See also", so you get an array with the following values: - 55436 - https://bugzilla.mozilla.org/show_bug.cgi?id=94505 - http://somewhere_else.com/external_link.htm Step2: convert all plain numbers into full bug urls from same installation: - 55436 -> https://bugzilla.mozilla.org/show_bug.cgi?id=55436 - https://bugzilla.mozilla.org/show_bug.cgi?id=94505 - http://somewhere_else.com/external_link.htm Step3: for display, auto-linkify all bug URLs from local installation - https://bugzilla.mozilla.org/show_bug.cgi?id=55436 -> bug 55436 - https://bugzilla.mozilla.org/show_bug.cgi?id=94505 -> bug 94505 - http://somewhere_else.com/external_link.htm So final display is this: See also: Bug 55436, Bug 94505, http://somewhere_else.com/external_link.htm (with or without the word bug) Please vote for this bug if you'd like the comfort and functionality of this RFE.
Replacing the URL by a shorter name is already what bug 475059 is asking for, and not only for local installations.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
Actually, the part about being able to enter bug numbers is not a duplicate, and is a valid request for something that I've wanted to do as well.
Blocks: bz-seealso
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Summary: "See also" field should parse / auto-linkify bug links from local bugzilla installation → "See also" field should parse bug numbers from the local bugzilla installation as valid
Max, adding a local bug number to "see also" means creating a link between two bugs on the local installation (e.g. bmo). I'd expect that for /local/ links, they should appear on /both/ bugs, i. e. when I set "see also: bug 475059" for this bug, then in bug 475059, we should also automatically add "see also: bug 549586" so that the link works both ways (same as we do for "depends/blocks" fields which are functionally very similar). Should I file that as a separate bug, or can we expect it as part of this bug?
(In reply to comment #3) > Max, adding a local bug number to "see also" means creating a link between two > bugs on the local installation (e.g. bmo). I'd expect that for /local/ links, > they should appear on /both/ bugs, i. e. when I set "see also: bug 475059" for > this bug, then in bug 475059, we should also automatically add "see also: bug > 549586" so that the link works both ways (same as we do for "depends/blocks" > fields which are functionally very similar). > > Should I file that as a separate bug, or can we expect it as part of this bug? Oh, that's a good point. Yeah, file it as a separate bug.
(In reply to comment #4) > Oh, that's a good point. Yeah, file it as a separate bug. -> bug 553932
Depends on: 553932
Attached patch v1 (obsolete) — Splinter Review
Max, small patch.
Assignee: create-and-change → timello
Status: REOPENED → ASSIGNED
Attachment #470349 - Flags: review?(mkanat)
Comment on attachment 470349 [details] [diff] [review] v1 >=== modified file 'Bugzilla/Bug.pm' >+ my $ref_bug = new Bugzilla::Bug->check($id); No "new". >+ if ($ref_bug->id == $self->id) { >+ ThrowUserError('bug_url_invalid', >+ { url => $input, reason => 'id_self_reference' }); Instead of using bug_url_invalid, I think we should use a new error, because the text here doesn't really make sense--you didn't input a URL, you input a bug number. Also, this should catch full-URL links to the local Bugzilla, not just aliases or ids. >+ $ref_bug->add_see_also($local_bug_uri . $self->id); >+ push @{ $self->{see_also_update} }, $ref_bug; Does that work even if see_also_update is undef?
Attachment #470349 - Flags: review?(mkanat) → review-
along with this enhancement cant we add URLs for bugzilla attachments also?
(In reply to comment #7) > Comment on attachment 470349 [details] [diff] [review] > > >+ $ref_bug->add_see_also($local_bug_uri . $self->id); > >+ push @{ $self->{see_also_update} }, $ref_bug; > > Does that work even if see_also_update is undef? It does.
Attached patch v2. (obsolete) — Splinter Review
Attachment #470349 - Attachment is obsolete: true
Attachment #470450 - Flags: review?(mkanat)
Attached patch v3. (obsolete) — Splinter Review
Fixing a nit.
Attachment #470450 - Attachment is obsolete: true
Attachment #470451 - Flags: review?(mkanat)
Attachment #470450 - Flags: review?(mkanat)
Comment on attachment 470451 [details] [diff] [review] v3. >=== modified file 'Bugzilla/Bug.pm' >+ if (my (undef, $id) = $input =~ m/^(\Q$local_bug_uri\E|)(\w+)$/) { This needs to happen only after the URL is canonicalized in the "show_bug" section below. So instead of this, just check for \w+ and change it into a URL, and then deal with the rest of it below in the show_bug section. >+ my $ref_bug = Bugzilla::Bug->check($id); I think you also need to call can_edit_product on the referred bug, to implement canedit protections.
Attachment #470451 - Flags: review?(mkanat) → review-
Target Milestone: --- → Bugzilla 4.2
Attached patch v4Splinter Review
Attachment #470451 - Attachment is obsolete: true
Attachment #471007 - Flags: review?(mkanat)
Comment on attachment 471007 [details] [diff] [review] v4 Looks great! Thanks timello! :-)
Attachment #471007 - Flags: review?(mkanat) → review+
Flags: approval+
Whiteboard: [es-redhat]
Committing to: bzr+ssh://timello%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Bug.pm modified template/en/default/global/user-error.html.tmpl Committed revision 7459.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago14 years ago
Resolution: --- → FIXED
The regexes weren't properly checking for the input URL actually *starting* with the specified urlbase, so things like "http://show_bug.cgi?id=2" would have triggered it. (This was breaking the xt/search.t test.)
Attachment #471650 - Flags: review+
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Bug.pm Committed revision 7461.
Blocks: 553932
No longer depends on: 553932
Blocks: 594083
Flags: testcase+
Keywords: relnote
Added to relnotes in bug 713346.
Keywords: relnote
Where can I find information when bmo (currently 4.0.8+) will be updated to Bugzilla 4.2 so that this useful feature will land there, too?
(In reply to Thomas D. from comment #19) > Where can I find information when bmo (currently 4.0.8+) will be updated to > Bugzilla 4.2 so that this useful feature will land there, too? BMO will hopefully be upgrading around the beginning of December. dkl
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: