aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2017-01-18 11:16:48 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-01-19 12:29:26 +0000
commita8afa603afcd3be86d9705e97b193983bbf6b34e (patch)
treea3d96d4e1327917614fd5e37d77255e2f9983f18 /perllib
parentfa669c507539cddbc913e7cff7fe8758236bd6cd (diff)
Redirect after user creation/edit
Solves a minor bug where it was difficult to create a new user and immediately assign permissions, as the page didn't show the appropriate permissions UI.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm16
1 files changed, 9 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index d8c5cdf6d..5d496e7e8 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -1220,10 +1220,8 @@ sub user_add : Path('user_edit') : Args(0) {
$c->forward( 'log_edit', [ $user->id, 'user', 'edit' ] );
- $c->stash->{status_message} =
- '<p><em>' . _('Updated!') . '</em></p>';
-
- return 1;
+ $c->flash->{status_message} = _("Updated!");
+ $c->res->redirect( $c->uri_for( 'user_edit', $user->id ) );
}
sub user_edit : Path('user_edit') : Args(1) {
@@ -1247,6 +1245,11 @@ sub user_edit : Path('user_edit') : Args(1) {
$c->forward('fetch_all_bodies');
$c->forward('fetch_body_areas', [ $user->from_body ]) if $user->from_body;
+ if ( defined $c->flash->{status_message} ) {
+ $c->stash->{status_message} =
+ '<p><em>' . $c->flash->{status_message} . '</em></p>';
+ }
+
if ( $c->get_param('submit') ) {
$c->forward('/auth/check_csrf_token');
@@ -1370,10 +1373,9 @@ sub user_edit : Path('user_edit') : Args(1) {
if ($edited) {
$c->forward( 'log_edit', [ $id, 'user', 'edit' ] );
}
+ $c->flash->{status_message} = _("Updated!");
+ $c->res->redirect( $c->uri_for( 'user_edit', $user->id ) );
}
-
- $c->stash->{status_message} =
- '<p><em>' . _('Updated!') . '</em></p>';
}
if ( $user->from_body ) {