aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-08-19 12:29:25 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-08-19 14:29:07 +0100
commite51bb2af37fbfe6efd3fad9a79e51010f6cad1aa (patch)
tree2bce3d55d7603782cdcfb53991f844948237134e /perllib/FixMyStreet/App/Controller/Report
parent0d5e096bad80e2f5969c79d489edbd3996e15987 (diff)
Get contribution state from server with map click.
This makes sure the correct dropdown is shown.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 86026f8e6..6934c6d79 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -186,6 +186,15 @@ sub report_form_ajax : Path('ajax') : Args(0) {
my $extra_titles_list = $c->cobrand->title_list($c->stash->{all_areas});
+ my $contribute_as = {};
+ if ($c->user_exists) {
+ my $bodies = join(',', keys %{$c->stash->{bodies}});
+ my $ca_another_user = $c->user->has_permission_to('contribute_as_another_user', $bodies);
+ my $ca_body = $c->user->has_permission_to('contribute_as_body', $bodies);
+ $contribute_as->{another_user} = $ca_another_user if $ca_another_user;
+ $contribute_as->{body} = $ca_body if $ca_body;
+ }
+
my $body = encode_json(
{
councils_text => $councils_text,
@@ -193,6 +202,7 @@ sub report_form_ajax : Path('ajax') : Args(0) {
extra_name_info => $extra_name_info,
titles_list => $extra_titles_list,
categories => $c->stash->{category_options},
+ %$contribute_as ? (contribute_as => $contribute_as) : (),
}
);