diff options
Diffstat (limited to 'extensions/Splinter')
-rw-r--r-- | extensions/Splinter/Extension.pm | 8 | ||||
-rw-r--r-- | extensions/Splinter/lib/Util.pm | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/extensions/Splinter/Extension.pm b/extensions/Splinter/Extension.pm index e0f42b8d0..eb2006f47 100644 --- a/extensions/Splinter/Extension.pm +++ b/extensions/Splinter/Extension.pm @@ -107,11 +107,11 @@ sub page_before_template { sub bug_format_comment { my ($self, $args) = @_; - + my $bug = $args->{'bug'}; my $regexes = $args->{'regexes'}; my $text = $args->{'text'}; - + # Add [review] link to the end of "Created attachment" comments # # We need to work around the way that the hook works, which is intended @@ -124,7 +124,7 @@ sub bug_format_comment { replace => get_review_link("$2", "[review]") })) && (attachment_id_is_patch($2) ? "$1 __REVIEW__$2" : $1) ~egmx; - + # And linkify "Review of attachment", this is less of a workaround since # there is no issue with overlap; note that there is an assumption that # there is only one match in the text we are linkifying, since they all @@ -150,7 +150,7 @@ sub config_add_panels { sub mailer_before_send { my ($self, $args) = @_; - + # Post-process bug mail to add review links to bug mail. # It would be nice to be able to hook in earlier in the # process when the email body is being formatted in the diff --git a/extensions/Splinter/lib/Util.pm b/extensions/Splinter/lib/Util.pm index a24881c1d..d85b0532b 100644 --- a/extensions/Splinter/lib/Util.pm +++ b/extensions/Splinter/lib/Util.pm @@ -53,14 +53,14 @@ use base qw(Exporter); sub attachment_id_is_valid { my ($attach_id, $dont_validate_access) = @_; - # Validate the specified attachment id. + # Validate the specified attachment id. detaint_natural($attach_id) || return 0; # Make sure the attachment exists in the database. my $attachment = new Bugzilla::Attachment({ id => $attach_id, cache => 1 }) || return 0; - return $attachment + return $attachment if ($dont_validate_access || attachment_is_visible($attachment)); } @@ -71,9 +71,9 @@ sub attachment_is_visible { $attachment->isa('Bugzilla::Attachment') || return 0; - return (Bugzilla->user->can_see_bug($attachment->bug->id) - && (!$attachment->isprivate - || Bugzilla->user->id == $attachment->attacher->id + return (Bugzilla->user->can_see_bug($attachment->bug->id) + && (!$attachment->isprivate + || Bugzilla->user->id == $attachment->attacher->id || Bugzilla->user->is_insider)); } @@ -107,7 +107,7 @@ sub get_review_link { my $attachment = attachment_id_is_valid($attach_id); if (attachment_id_is_patch($attach_id)) { - return "<a href='" . html_quote(get_review_url($attachment->bug, $attach_id)) . + return "<a href='" . html_quote(get_review_url($attachment->bug, $attach_id)) . "'>$link_text</a>"; } else { @@ -122,7 +122,7 @@ sub munge_create_attachment { return ("$intro_text" . " View: $view_link\015\012" . " Review: " . get_review_url($bug, $attach_id, 1) . "\015\012"); - } + } else { return ("$intro_text --> ($view_link)"); } @@ -143,7 +143,7 @@ sub add_review_links_to_email { my $new_body = 0; my $bug; - if ($email->header('Subject') =~ /^\[Bug\s+(\d+)\]/ + if ($email->header('Subject') =~ /^\[Bug\s+(\d+)\]/ && Bugzilla->user->can_see_bug($1)) { $bug = Bugzilla::Bug->new({ id => $1, cache => 1 }); |