aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-30 16:53:56 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-30 16:53:56 +0100
commitb756440e4b5c0b356ee0d65d1647124317535c95 (patch)
tree89b3e9df8cb1d86f75a02eb298de84694e26fed6
parentcad4d9856b13328fd1e64ff6b48ee47234741960 (diff)
some extra info on updates
-rw-r--r--t/app/controller/admin.t70
-rw-r--r--templates/web/default/admin/update_edit.html16
2 files changed, 85 insertions, 1 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index c5d253459..dcf45e983 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -639,6 +639,76 @@ for my $test (
};
}
+for my $test (
+ {
+ desc => 'user is problem owner',
+ problem_user => $user,
+ update_user => $user,
+ update_fixed => 0,
+ update_reopen => 0,
+ update_state => undef,
+ user_council => undef,
+ content => 'user is problem owner',
+ },
+ {
+ desc => 'user is council user',
+ problem_user => $user,
+ update_user => $user2,
+ update_fixed => 0,
+ update_reopen => 0,
+ update_state => undef,
+ user_council => 2504,
+ content => 'user is from same council as problem - 2504',
+ },
+ {
+ desc => 'update changed problem state',
+ problem_user => $user,
+ update_user => $user2,
+ update_fixed => 0,
+ update_reopen => 0,
+ update_state => 'planned',
+ user_council => 2504,
+ content => 'Update changed problem state to planned',
+ },
+ {
+ desc => 'update marked problem as fixed',
+ problem_user => $user,
+ update_user => $user3,
+ update_fixed => 1,
+ update_reopen => 0,
+ update_state => undef,
+ user_council => undef,
+ content => 'Update marked problem as fixed',
+ },
+ {
+ desc => 'update reopened problem',
+ problem_user => $user,
+ update_user => $user,
+ update_fixed => 0,
+ update_reopen => 1,
+ update_state => undef,
+ user_council => undef,
+ content => 'Update reopened problem',
+ },
+) {
+ subtest $test->{desc} => sub {
+ $report->user( $test->{problem_user} );
+ $report->update;
+
+ $update->user( $test->{update_user} );
+ $update->problem_state( $test->{update_state} );
+ $update->mark_fixed( $test->{update_fixed} );
+ $update->mark_open( $test->{update_reopen} );
+ $update->update;
+
+ $test->{update_user}->from_council( $test->{user_council} );
+ $test->{update_user}->update;
+
+ $mech->get_ok('/admin/update_edit/' . $update->id );
+ $mech->content_contains( $test->{content} );
+ };
+}
+
subtest 'editing update email creates new user if required' => sub {
my $user = FixMyStreet::App->model('DB::User')->find(
{ email => 'test4@example.com' }
diff --git a/templates/web/default/admin/update_edit.html b/templates/web/default/admin/update_edit.html
index d7f212052..8746e62c4 100644
--- a/templates/web/default/admin/update_edit.html
+++ b/templates/web/default/admin/update_edit.html
@@ -21,7 +21,21 @@
[% END %]
</select></li>
<li>[% loc('Name:') %] <input type='text' name='name' id='name' value='[% update.name | html %]'></li>
-<li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% update.user.email | html %]'></li>
+<li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% update.user.email | html %]'>
+[%- IF update.user.from_council && update.user.from_council == update.problem.council %]
+[% ' (' _ tprintf(loc('user is from same council as problem - %d'), update.user.from_council ) _')' %]
+[% END -%]
+[%- IF update.user.id == update.problem.user.id %]
+[% ' (' _ loc('user is problem owner') _')' %]
+[% END -%]
+</li>
+[% IF update.problem_state %]
+<li>[% tprintf(loc('Update changed problem state to %s'), update.problem_state) %]</li>
+[% ELSIF update.mark_fixed %]
+<li>[% loc('Update marked problem as fixed') %]</li>
+[% ELSIF update.user.id == update.problem.user.id && update.mark_open %]
+<li>[% loc('Update reopened problem') %]</li>
+[% END %]
<li>[% loc('Cobrand:') %] [% update.cobrand %]</li>
<li>[% loc('Cobrand data:') %] [% update.cobrand_data %]</li>
<li>[% loc('Created:') %] [% PROCESS format_time time=update.created %]</li>