Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
01e6cf5c
Commit
01e6cf5c
authored
Sep 01, 2010
by
Tiago Mello
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 549586: Allow the See Also field to take an integer or a local
bugzilla url and treat them as a link to the local Bugzilla. r/a=mkanat
parent
cd51ea19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
Bug.pm
Bugzilla/Bug.pm
+40
-0
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+4
-0
No files found.
Bugzilla/Bug.pm
View file @
01e6cf5c
...
...
@@ -952,6 +952,9 @@ sub update {
join
(
', '
,
@$added_see
)];
}
# Call update for the referenced bugs.
$_
->
update
()
foreach
@
{
$self
->
{
see_also_update
}
||
[]
};
# Log bugs_activity items
# XXX Eventually, when bugs_activity is able to track the dupe_id,
# this code should go below the duplicates-table-updating code below.
...
...
@@ -1192,6 +1195,12 @@ sub send_changes {
_send_bugmail
({
forced
=>
{
changer
=>
$user
},
type
=>
"dep"
,
id
=>
$id
},
$vars
);
}
# Sending emails for the referenced bugs.
foreach
my
$ref_bug
(
@
{
$self
->
{
see_also_update
}
||
[]
})
{
_send_bugmail
({
forced
=>
{
changer
=>
$user
},
id
=>
$ref_bug
->
id
},
$vars
);
}
}
sub
_send_bugmail
{
...
...
@@ -2785,6 +2794,13 @@ sub add_see_also {
my
(
$self
,
$input
)
=
@_
;
$input
=
trim
(
$input
);
# If a bug id/alias has been taken, then treat it
# as a link to the local Bugzilla.
my
$local_bug_uri
=
correct_urlbase
()
.
"show_bug.cgi?id="
;
if
(
my
(
$id
)
=
$input
=~
m/^(\w+)$/
)
{
$input
=
$local_bug_uri
.
$id
;
}
# We assume that the URL is an HTTP URL if there is no (something)://
# in front.
my
$uri
=
new
URI
(
$input
);
...
...
@@ -2881,6 +2897,30 @@ sub add_see_also {
# And remove any # part if there is one.
$uri
->
fragment
(
undef
);
$result
=
$uri
->
canonical
->
as_string
;
# See Also field of the referenced bug is updated
# to point to the current bug.
if
(
$result
=~
m/\Q$local_bug_uri\E/
)
{
my
$ref_bug
=
Bugzilla::
Bug
->
check
(
$bug_id
);
if
(
$ref_bug
->
id
==
$self
->
id
)
{
ThrowUserError
(
'see_also_self_reference'
);
}
my
$product
=
$ref_bug
->
product_obj
;
if
(
!
Bugzilla
->
user
->
can_edit_product
(
$product
->
id
))
{
ThrowUserError
(
"product_edit_denied"
,
{
product
=>
$product
->
name
});
}
# We add it directly instead of calling $ref_bug->add_see_also
# to avoid recursion.
my
$ref_input
=
$local_bug_uri
.
$self
->
id
;
if
(
!
grep
(
$ref_input
,
@
{
$ref_bug
->
see_also
}))
{
push
@
{
$ref_bug
->
see_also
},
$ref_input
;
push
@
{
$self
->
{
see_also_update
}
},
$ref_bug
;
}
}
}
if
(
length
(
$result
)
>
MAX_BUG_URL_LENGTH
)
{
...
...
template/en/default/global/user-error.html.tmpl
View file @
01e6cf5c
...
...
@@ -1470,6 +1470,10 @@
field with the "[% search_descs.$operator FILTER html %]"
([% operator FILTER html %]) search type.
[% ELSIF error == 'see_also_self_reference' %]
You cannot put this [% terms.bug %] into its own
[%+ field_descs.see_also %] field.
[% ELSIF error == "series_already_exists" %]
[% title = "Series Already Exists" %]
[% docslinks = {'reporting.html' => 'Reporting'} %]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment