Closed
Bug 704999
Opened 13 years ago
Closed 13 years ago
Add support for GitHub for the 'See Also' field
Categories
(Bugzilla :: Creating/Changing Bugs, enhancement)
Bugzilla
Creating/Changing Bugs
Tracking
()
RESOLVED
FIXED
Bugzilla 4.4
People
(Reporter: mgorny, Assigned: selsky)
References
(Depends on 1 open bug)
Details
Attachments
(1 file, 4 obsolete files)
2.04 KB,
patch
|
timello
:
review+
|
Details | Diff | Splinter Review |
Please add support for adding github issues in the 'See Also' field. Those take URL in the form:
https://github.com/<user>/<project>/issues/<n>
where <user> & <project> would be \S+?, and <n> would be \d+.
Assignee | ||
Comment 1•13 years ago
|
||
Assignee: general → selsky
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #578698 -
Flags: review?(timello)
Reporter | ||
Comment 2•13 years ago
|
||
Comment on attachment 578698 [details] [diff] [review]
Add support for github issues, v1
Just a side comment:
> + # While GitHub URLs can be either HTTP or HTTPS,
> + # always go with the HTTPS scheme, as that's the default.
That's not exactly true, I'd say. Github URLs are always https; http always redirects.
Assignee | ||
Comment 3•13 years ago
|
||
How's this?
Attachment #578698 -
Attachment is obsolete: true
Attachment #578698 -
Flags: review?(timello)
Attachment #578772 -
Flags: review?(timello)
Updated•13 years ago
|
Depends on: bz-seealso
Comment 4•13 years ago
|
||
Comment on attachment 578772 [details] [diff] [review]
Add support for github issues, v2
Review of attachment 578772 [details] [diff] [review]:
-----------------------------------------------------------------
::: Bugzilla/BugUrl/GitHub.pm
@@ +50,5 @@
> + $username = $1;
> + $repository_name = $2;
> + $issue_id = $3;
> + } else {
> + ThrowUserError('bug_url_invalid', { url => $value });
Same as GetSatisfaction, should_handle could look for the right pattern and then we let class_for throw the error.
Attachment #578772 -
Flags: review?(timello) → review-
Assignee | ||
Comment 5•13 years ago
|
||
I was following the examples of Debian.pm, Google.pm, Launchpad.pm, and Sourceforge.pm
Should those also have a more complete pattern in should_handle?
Comment 6•13 years ago
|
||
CC'ing timello so that he can reply to Matt's question in comment 5.
Severity: normal → enhancement
Component: Bugzilla-General → Creating/Changing Bugs
OS: Linux → All
Hardware: x86_64 → All
Target Milestone: --- → Bugzilla 5.0
Comment 7•13 years ago
|
||
(In reply to Matt Selsky [:selsky] from comment #5)
> I was following the examples of Debian.pm, Google.pm, Launchpad.pm, and
> Sourceforge.pm
>
> Should those also have a more complete pattern in should_handle?
You know what? If class_for already does that why we are repeating code in the subclasses? Also, I think the reason => 'show_bug' only applies to Bugzillas... and we can't say if the 'id' is whether valid or not, unless per the pattern...
So I think we could:
1. Move the content of [% IF reason == 'show_bug' %] in the user-error template to an [% ELSE %] and then no need to pass 'reason' in the class_for.
2. Completely remove the reason 'id' and 'show_bug' because we are going to catch that in the pattern of the should_handle method.
I think it's enough to say that the url must be a valid url from any of the listed bug trackers.
Comment 8•13 years ago
|
||
So, the _check_value method would only be in charge of returning the URI object with the shortest url form for the bug tracker...
+1 this would be fantastic for b2g and pdf.js, which span across github and bugzilla.
Assignee | ||
Comment 10•13 years ago
|
||
Updated should_handle as per comment 7. Should _check_value be renamed to _canonify_url, or similar, since that's the purpose as per comment 8?
Attachment #578772 -
Attachment is obsolete: true
Attachment #588800 -
Flags: review?(timello)
Assignee | ||
Comment 11•13 years ago
|
||
Don't use Bugzilla::{Util,Error} since those are only called in the parent class.
Attachment #588800 -
Attachment is obsolete: true
Attachment #588800 -
Flags: review?(timello)
Attachment #588805 -
Flags: review?(timello)
Comment 12•13 years ago
|
||
(In reply to Matt Selsky [:selsky] from comment #10)
> Created attachment 588800 [details] [diff] [review]
> Add support for github issues, v3
>
> Updated should_handle as per comment 7. Should _check_value be renamed to
> _canonify_url, or similar, since that's the purpose as per comment 8?
No, _check_[something] is the default name for every validator in Bugzilla even though it is not actually 'validating' anything.
Comment 13•13 years ago
|
||
Comment on attachment 588805 [details] [diff] [review]
Add support for github issues, v4
>=== added file 'Bugzilla/BugUrl/GitHub.pm'
+
>+sub should_handle {
>+ my ($class, $uri) = @_;
>+
>+ # GitHub issue URLs have only one form:
>+ # https://github.com/USER_OR_TEAM_OR_ORGANIZATION_NAME/REPOSITORY_NAME/issues/111
>+ return ($uri->authority =~ /^github.com$/i
>+ and $uri->path =~ m|^/[^/]+/[^/]+/issues/\d+$|) ? 1 : 0;
Ah! This is where that GetSatisfaction code came from :)
>+}
>+
>+sub _check_value {
>+ my $class = shift;
>+
>+ my $uri = $class->SUPER::_check_value(@_);
>+
>+ # GitHub HTTP URLs simply redirect to HTTPS, so just use
>+ # the HTTPS scheme.
>+ if ($uri->scheme eq 'http') {
>+ $uri->scheme('https');
>+ }
I agree, this is doing the exactly the same as GetSatisfaction does.
Lets create a common method and use it here. Maybe as you
suggested _canonify_url and call it here.
Otherwise, it looks good.
Attachment #588805 -
Flags: review?(timello) → review-
Updated•13 years ago
|
Summary: Please add support for github issue trackers to the 'See also' field → Add support for GitHub for the 'See Also' field
Comment 14•13 years ago
|
||
Matt, are you still available to update the patch? We'd really like this on b.m.o.
Assignee | ||
Comment 16•13 years ago
|
||
Simplify the scheme forcing.
Attachment #588805 -
Attachment is obsolete: true
Attachment #609614 -
Flags: review?(timello)
Comment 17•13 years ago
|
||
Comment on attachment 609614 [details] [diff] [review]
Add support for github issues, v5
The patch should be changed to add GitHub in the MoreBugUrl extension.
Attachment #609614 -
Flags: review?(timello) → review-
Comment 18•13 years ago
|
||
I think GitHub is popular enough to be in the core code.
Comment 19•13 years ago
|
||
Comment on attachment 609614 [details] [diff] [review]
Add support for github issues, v5
So, otherwise the patch looks good.
Attachment #609614 -
Flags: review- → review+
Updated•13 years ago
|
Flags: approval?
Updated•13 years ago
|
Flags: approval? → approval+
Comment 20•13 years ago
|
||
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/BugUrl.pm
added Bugzilla/BugUrl/GitHub.pm
modified template/en/default/global/user-error.html.tmpl
Committed revision 8202.
You need to log in
before you can comment on or make changes to this bug.
Description
•