summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.htaccess1
-rw-r--r--extensions/Splinter/Extension.pm10
-rw-r--r--extensions/Splinter/lib/Util.pm34
-rw-r--r--extensions/Splinter/template/en/default/admin/params/splinter.html.tmpl2
-rw-r--r--extensions/Splinter/template/en/default/hook/attachment/edit-action.html.tmpl10
-rw-r--r--extensions/Splinter/template/en/default/hook/attachment/list-action.html.tmpl10
-rw-r--r--extensions/Splinter/template/en/default/hook/request/email-after_summary.txt.tmpl5
-rw-r--r--extensions/Splinter/template/en/default/hook/request/queue-after_column.html.tmpl8
-rw-r--r--extensions/Splinter/template/en/default/pages/splinter.html.tmpl8
9 files changed, 41 insertions, 47 deletions
diff --git a/.htaccess b/.htaccess
index e927ad44f..92c07097a 100644
--- a/.htaccess
+++ b/.htaccess
@@ -37,6 +37,7 @@ Redirect permanent /etiquette.html https://bugzilla.mozilla.org/page.cgi?id=etiq
Redirect permanent /duplicates.html https://bugzilla.mozilla.org/duplicates.cgi
RewriteEngine On
+RewriteRule ^review(.*) page.cgi?id=splinter.html$1 [QSA]
RewriteRule ^favicon\.ico$ extensions/BMO/web/images/favicon.ico
RewriteRule ^form[\.:](itrequest|mozlist|mktgevent|poweredby|presentation|trademark|recoverykey)$ enter_bug.cgi?product=mozilla.org&format=$1
RewriteRule ^form[\.:]legal$ enter_bug.cgi?product=Legal&format=legal
diff --git a/extensions/Splinter/Extension.pm b/extensions/Splinter/Extension.pm
index 980ab0054..ecf61ea9a 100644
--- a/extensions/Splinter/Extension.pm
+++ b/extensions/Splinter/Extension.pm
@@ -18,6 +18,16 @@ use Bugzilla::Extension::Splinter::Util;
our $VERSION = '0.1';
+BEGIN {
+ *Bugzilla::splinter_review_base = \&get_review_base;
+ *Bugzilla::splinter_review_url = \&_get_review_url;
+}
+
+sub _get_review_url {
+ my ($class, $bug_id, $attach_id) = @_;
+ return get_review_url(Bugzilla::Bug->check({ id => $bug_id, cache => 1 }), $attach_id);
+}
+
sub page_before_template {
my ($self, $args) = @_;
my ($vars, $page) = @$args{qw(vars page_id)};
diff --git a/extensions/Splinter/lib/Util.pm b/extensions/Splinter/lib/Util.pm
index 9f09d3dcc..5258334a7 100644
--- a/extensions/Splinter/lib/Util.pm
+++ b/extensions/Splinter/lib/Util.pm
@@ -29,10 +29,11 @@ use Bugzilla::Util;
use base qw(Exporter);
@Bugzilla::Extension::Splinter::Util::EXPORT = qw(
- attachment_is_visible
+ attachment_is_visible
attachment_id_is_patch
- get_review_url
- get_review_link
+ get_review_base
+ get_review_url
+ get_review_link
add_review_links_to_email
);
@@ -80,23 +81,20 @@ sub attachment_id_is_patch {
return ($attachment && $attachment->ispatch);
}
-sub get_review_url {
- my ($bug, $attach_id, $absolute) = @_;
+sub get_review_base {
my $base = Bugzilla->params->{'splinter_base'};
- my $bug_id = $bug->id;
-
- if (defined $absolute && $absolute) {
- my $urlbase = correct_urlbase();
- $urlbase =~ s!/$!! if $base =~ "^/";
- $base = $urlbase . $base;
- }
+ $base =~ s!/$!!;
+ my $urlbase = correct_urlbase();
+ $urlbase =~ s!/$!! if $base =~ "^/";
+ $base = $urlbase . $base;
+ return $base;
+}
- if ($base =~ /\?/) {
- return "$base&bug=$bug_id&attachment=$attach_id";
- }
- else {
- return "$base?bug=$bug_id&attachment=$attach_id";
- }
+sub get_review_url {
+ my ($bug, $attach_id) = @_;
+ my $base = get_review_base();
+ my $bug_id = $bug->id;
+ return $base . ($base =~ /\?/ ? '&' : '?') . "bug=$bug_id&attachment=$attach_id";
}
sub get_review_link {
diff --git a/extensions/Splinter/template/en/default/admin/params/splinter.html.tmpl b/extensions/Splinter/template/en/default/admin/params/splinter.html.tmpl
index c92c62e5d..b28a4bd37 100644
--- a/extensions/Splinter/template/en/default/admin/params/splinter.html.tmpl
+++ b/extensions/Splinter/template/en/default/admin/params/splinter.html.tmpl
@@ -32,7 +32,7 @@
"the following lines to the .htaccess for Bugzilla: " _
"<pre>" _
"RewriteEngine On\n" _
- "RewriteRule ^review(\?(.*))? page.cgi?id=splinter.html&amp;&#x0024;2 [L]" _
+ "RewriteRule ^review(.*) page.cgi?id=splinter.html\$1 [QSA]" _
"</pre>"
}
%]
diff --git a/extensions/Splinter/template/en/default/hook/attachment/edit-action.html.tmpl b/extensions/Splinter/template/en/default/hook/attachment/edit-action.html.tmpl
index ba564d4b4..7648e1d76 100644
--- a/extensions/Splinter/template/en/default/hook/attachment/edit-action.html.tmpl
+++ b/extensions/Splinter/template/en/default/hook/attachment/edit-action.html.tmpl
@@ -20,12 +20,6 @@
#%]
[% IF attachment.ispatch %]
-&#x0020; |
- [% IF Param("splinter_base").search('\?') %]
- <a href="[% urlbase FILTER none %][% Param("splinter_base") FILTER html %]&amp;bug=[% attachment.bug_id FILTER uri %]&amp;attachment=[% attachment.id FILTER uri%]">
- Splinter Review</a>
- [% ELSE %]
- <a href="[% urlbase FILTER none %][% Param("splinter_base") FILTER html %]?bug=[% attachment.bug_id FILTER uri %]&amp;attachment=[% attachment.id FILTER uri %]">
- Splinter Review</a>
- [% END %]
+ &#x0020; |
+ <a href="[% Bugzilla.splinter_review_url(attachment.bug_id, attachment.id) FILTER none %]">Review</a>
[% END %]
diff --git a/extensions/Splinter/template/en/default/hook/attachment/list-action.html.tmpl b/extensions/Splinter/template/en/default/hook/attachment/list-action.html.tmpl
index 51babf079..cd2db2770 100644
--- a/extensions/Splinter/template/en/default/hook/attachment/list-action.html.tmpl
+++ b/extensions/Splinter/template/en/default/hook/attachment/list-action.html.tmpl
@@ -20,12 +20,6 @@
#%]
[% IF attachment.ispatch %]
-&#x0020; |
- [% IF Param("splinter_base").search('\?') %]
- <a href="[% urlbase FILTER none %][% Param("splinter_base") FILTER html %]&amp;bug=[% bugid FILTER uri %]&amp;attachment=[% attachment.id FILTER uri %]">
- Splinter Review</a>
- [% ELSE %]
- <a href="[% urlbase FILTER none %][% Param("splinter_base") FILTER html %]?bug=[% bugid FILTER uri %]&amp;attachment=[% attachment.id FILTER uri %]">
- Splinter Review</a>
- [% END %]
+ &#x0020; |
+ <a href="[% Bugzilla.splinter_review_url(bug.id, attachment.id) FILTER none %]">Review</a>
[% END %]
diff --git a/extensions/Splinter/template/en/default/hook/request/email-after_summary.txt.tmpl b/extensions/Splinter/template/en/default/hook/request/email-after_summary.txt.tmpl
index 320d20a82..c9717fbd6 100644
--- a/extensions/Splinter/template/en/default/hook/request/email-after_summary.txt.tmpl
+++ b/extensions/Splinter/template/en/default/hook/request/email-after_summary.txt.tmpl
@@ -1,6 +1,7 @@
+[% USE Bugzilla %]
[% IF flag && flag.status == '?' && flag.type.name == 'review' && attachment && attachment.ispatch %]
-Splinter Review
-[%+ urlbase FILTER none %][% Param('splinter_base') %]&bug=[% bug.bug_id FILTER uri %]&attachment=[% attachment.id FILTER uri %]
+Review
+[%+ Bugzilla.splinter_review_url(request.bug_id, request.attach_id) FILTER none %]
[%- END %]
diff --git a/extensions/Splinter/template/en/default/hook/request/queue-after_column.html.tmpl b/extensions/Splinter/template/en/default/hook/request/queue-after_column.html.tmpl
index 5d1c7a2bb..a5fc61cea 100644
--- a/extensions/Splinter/template/en/default/hook/request/queue-after_column.html.tmpl
+++ b/extensions/Splinter/template/en/default/hook/request/queue-after_column.html.tmpl
@@ -1,8 +1,4 @@
[% IF column == 'attachment' && request.ispatch %]
- &nbsp;
- [% IF Param("splinter_base").search('\?') %]
- <a href="[% urlbase FILTER none %][% Param("splinter_base") FILTER html %]&amp;bug=[% request.bug_id FILTER uri %]&amp;attachment=[% request.attach_id FILTER uri %]">[review]</a>
- [% ELSE %]
- <a href="[% urlbase FILTER none %][% Param("splinter_base") FILTER html %]?bug=[% request.bug_id FILTER uri %]&amp;attachment=[% request.attach_id FILTER uri %]">[review]</a>
- [% END %]
+ &nbsp;
+ <a href="[% Bugzilla.splinter_review_url(request.bug_id, request.attach_id) FILTER none %]">[review]</a>
[% END %]
diff --git a/extensions/Splinter/template/en/default/pages/splinter.html.tmpl b/extensions/Splinter/template/en/default/pages/splinter.html.tmpl
index 1814da58c..fc4748548 100644
--- a/extensions/Splinter/template/en/default/pages/splinter.html.tmpl
+++ b/extensions/Splinter/template/en/default/pages/splinter.html.tmpl
@@ -44,10 +44,10 @@
[% can_edit = 0 %]
<script type="text/javascript">
- Splinter.configBase = '[% urlbase FILTER none %][% Param('splinter_base') FILTER js %]';
- Splinter.configBugUrl = '[% urlbase FILTER none %]';
+ Splinter.configBase = '[% Bugzilla.splinter_review_base FILTER js %]';
+ Splinter.configBugUrl = '[% urlbase FILTER js %]';
Splinter.configHaveExtension = true;
- Splinter.configHelp = '[% urlbase FILTER none %]page.cgi?id=splinter/help.html';
+ Splinter.configHelp = '[% urlbase FILTER js %]page.cgi?id=splinter/help.html';
Splinter.configNote = '';
Splinter.configAttachmentStatuses = [
@@ -114,7 +114,7 @@
<![endif]-->
<div id="helpful-links">
- <a id="allReviewsLink" href="[% urlbase FILTER none %][% Param('splinter_base') FILTER js %]">
+ <a id="allReviewsLink" href="[% Bugzilla.splinter_review_base FILTER none %]">
[reviews]</a>
<a id='helpLink' target='splinterHelp'
href="[% urlbase FILTER none %]page.cgi?id=splinter/help.html">