From a8e7842bd2a2e7f6f25cd947aca5174356d9bfcc Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 5 Jun 2013 09:42:46 +0100 Subject: [PATCH] Only append cobrand_data to URI if present. --- t/app/controller/admin.t | 8 ++++---- templates/web/default/admin/list_updates.html | 12 +++++++++--- templates/web/default/admin/problem_row.html | 12 +++++++++--- templates/web/default/admin/report_edit.html | 12 +++++++++--- templates/web/default/admin/timeline.html | 6 +++--- templates/web/default/admin/update_edit.html | 12 +++++++++--- 6 files changed, 43 insertions(+), 19 deletions(-) diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 65e2529545..521497f3ee 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -1032,13 +1032,13 @@ subtest 'report search' => sub { $mech->content_contains( $report->title ); my $r_id = $report->id; - $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/">$r_id} ); + $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id} ); $mech->get_ok('/admin/reports?search=' . $report->user->email); my $u_id = $update->id; - $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/">$r_id} ); - $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/#update_$u_id">$u_id} ); + $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id} ); + $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id#update_$u_id">$u_id} ); $update->state('hidden'); $update->update; @@ -1056,7 +1056,7 @@ subtest 'report search' => sub { $report->update; $mech->get_ok('/admin/reports?search=' . $report->user->email); - $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id/">$r_id} ); + $mech->content_like( qr{href="http://[^/]*[^.]/report/$r_id">$r_id} ); }; subtest 'search abuse' => sub { diff --git a/templates/web/default/admin/list_updates.html b/templates/web/default/admin/list_updates.html index 6813378440..dbf679702b 100644 --- a/templates/web/default/admin/list_updates.html +++ b/templates/web/default/admin/list_updates.html @@ -18,9 +18,15 @@

[% loc('Updates') %]

[% FOREACH update IN updates -%] [%- IF update.state == 'confirmed' && update.problem.state != 'hidden' -%] - [%- cobrand_data = update.cobrand_data %] - [%- cobrand_data = c.data_for_generic_update IF !update.cobrand %] - [% update.id %] + [%- cobrand_data = update.cobrand_data; + cobrand_data = c.data_for_generic_update IF !update.cobrand; + IF cobrand_data; + uri = c.uri_for_email( '/report', update.problem.id, cobrand_data ); + ELSE; + uri = c.uri_for_email( '/report', update.problem.id ); + END; + %] + [% update.id %] [%- ELSE %] [%- update.id %] [%- END -%] diff --git a/templates/web/default/admin/problem_row.html b/templates/web/default/admin/problem_row.html index ec8fda6c53..6dc4de1889 100644 --- a/templates/web/default/admin/problem_row.html +++ b/templates/web/default/admin/problem_row.html @@ -1,9 +1,15 @@ [%- FOR problem IN problems %] [%- IF problem.is_visible -%] - [%- cobrand_data = problem.cobrand_data %] - [%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %] - [% problem.id %] + [%- cobrand_data = problem.cobrand_data; + cobrand_data = c.data_for_generic_problem IF !problem.cobrand; + IF cobrand_data; + uri = c.uri_for_email( '/report', problem.id, cobrand_data ); + ELSE; + uri = c.uri_for_email( '/report', problem.id ); + END; + %] + [% problem.id %] [%- ELSE %] [%- problem.id %] [%- END -%] diff --git a/templates/web/default/admin/report_edit.html b/templates/web/default/admin/report_edit.html index b9527af73c..f3307658d6 100644 --- a/templates/web/default/admin/report_edit.html +++ b/templates/web/default/admin/report_edit.html @@ -7,9 +7,15 @@
    - [%- cobrand_data = problem.cobrand_data %] - [%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %] -
  • [% loc('View report on site' )%]
  • + [%- cobrand_data = problem.cobrand_data; + cobrand_data = c.data_for_generic_problem IF !problem.cobrand; + IF cobrand_data; + uri = c.uri_for_email( '/report', problem.id, cobrand_data ); + ELSE; + uri = c.uri_for_email( '/report', problem.id ); + END; + %] +
  • [% loc('View report on site' )%]
  • diff --git a/templates/web/default/admin/timeline.html b/templates/web/default/admin/timeline.html index 2c77e3fbde..2e4c3b7717 100644 --- a/templates/web/default/admin/timeline.html +++ b/templates/web/default/admin/timeline.html @@ -21,16 +21,16 @@

    [% curdate %]

    [% CASE 'problemCreated' %] [%- tprintf(loc('Problem %d created'), item.obj.id) %]; [% PROCESS problem_name problem=item.obj -%] [% CASE 'problemConfirmed' %] - [%- tprintf( loc('Problem %s confirmed'), '' _ item.obj.id _ '') %]; [% PROCESS problem_name problem=item.obj -%] + [%- tprintf( loc('Problem %s confirmed'), '' _ item.obj.id _ '') %]; [% PROCESS problem_name problem=item.obj -%] [% CASE 'problemSent' %] - [% tprintf(loc("Problem %s sent to council %s"), '' _ item.obj.id _ '', item.obj.bodies_str ) %] + [% tprintf(loc("Problem %s sent to council %s"), '' _ item.obj.id _ '', item.obj.bodies_str ) %] [% CASE 'quesSent' %] [% tprintf(loc("Questionnaire %d sent for problem %d"), item.obj.id, item.obj.problem_id ) %] [% CASE 'quesAnswered' %] [% tprintf(loc("Questionnaire %d answered for problem %d, %s to %s"), item.obj.id, item.obj.problem_id, item.obj.old_state, item.obj.new_state ) %] [% CASE 'update' %] [% name = ( item.obj.name || 'anonymous' ) | html %] - [% tprintf(loc("Update %s created for problem %d; by %s"), "" _ item.obj.id _ "", item.obj.problem_id, name) %] <[% item.obj.user.email | html %]> + [% tprintf(loc("Update %s created for problem %d; by %s"), "" _ item.obj.id _ "", item.obj.problem_id, name) %] <[% item.obj.user.email | html %]> [% CASE 'alertSub' %] [% tprintf(loc("Alert %d created for %s, type %s, parameters %s / %s"), item.obj.id, item.obj.user.email, item.obj.alert_type.ref, item.obj.parameter, item.obj.parameter2) | html %] [% CASE 'alertDel' %] diff --git a/templates/web/default/admin/update_edit.html b/templates/web/default/admin/update_edit.html index 26d262f73a..f2029c63fd 100644 --- a/templates/web/default/admin/update_edit.html +++ b/templates/web/default/admin/update_edit.html @@ -7,9 +7,15 @@
      - [%- cobrand_data = update.cobrand_data %] - [%- cobrand_data = c.data_for_generic_update IF !update.cobrand %] -
    • [% loc('View report on site' )%]
    • + [%- cobrand_data = update.cobrand_data; + cobrand_data = c.data_for_generic_update IF !update.cobrand; + IF cobrand_data; + uri = c.uri_for_email( '/report', update.problem_id, cobrand_data ); + ELSE; + uri = c.uri_for_email( '/report', update.problem_id ); + END; + %] +
    • [% loc('View report on site' )%]