aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm10
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm6
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm2
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm23
7 files changed, 26 insertions, 25 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index a96562cd6..fcbde1bd9 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -733,9 +733,9 @@ sub search_users: Path('search_users') : Args(0) {
my $users = $c->model('DB::User')->search(
{
-or => [
- email => { ilike => $isearch },
- name => { ilike => $isearch },
- from_council => $search_n,
+ email => { ilike => $isearch },
+ name => { ilike => $isearch },
+ from_body => $search_n,
]
}
);
@@ -881,13 +881,13 @@ sub user_edit : Path('user_edit') : Args(1) {
if ( $user->email ne $c->req->param('email') ||
$user->name ne $c->req->param('name' ) ||
- $user->from_council != $c->req->param('council') ) {
+ $user->from_body != $c->req->param('council') ) {
$edited = 1;
}
$user->name( $c->req->param('name') );
$user->email( $c->req->param('email') );
- $user->from_council( $c->req->param('council') || undef );
+ $user->from_body( $c->req->param('council') || undef );
$user->flagged( $c->req->param('flagged') || 0 );
$user->update;
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm
index a5ba8ff07..94450f4f3 100644
--- a/perllib/FixMyStreet/App/Controller/Dashboard.pm
+++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm
@@ -74,9 +74,9 @@ sub check_page_allowed : Private {
$c->detach( '/auth/redirect' ) unless $c->user_exists;
$c->detach( '/page_error_404_not_found' )
- unless $c->user_exists && $c->user->from_council;
+ unless $c->user_exists && $c->user->from_body;
- return $c->user->from_council;
+ return $c->user->from_body;
}
=head2 index
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index a7e1e8a3a..2c56cd182 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -66,7 +66,7 @@ sub support : Path('support') : Args(0) {
? $c->uri_for( '/report', $id )
: $c->uri_for('/');
- if ( $id && $c->cobrand->can_support_problems && $c->user && $c->user->from_council ) {
+ if ( $id && $c->cobrand->can_support_problems && $c->user && $c->user->from_body ) {
$c->forward( 'load_problem_or_display_error', [ $id ] );
$c->stash->{problem}->update( { interest_count => \'interest_count +1' } );
}
@@ -187,7 +187,7 @@ sub delete :Local :Args(1) {
return $c->res->redirect($uri) unless $c->user_exists;
- my $council = $c->user->obj->from_council;
+ my $council = $c->user->obj->from_body;
return $c->res->redirect($uri) unless $council;
my %councils = map { $_ => 1 } @{$p->councils};
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 7759bb938..823b38e02 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -1094,7 +1094,7 @@ sub redirect_or_confirm_creation : Private {
$c->forward( 'create_reporter_alert' );
my $report_uri;
- if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{external_source_id}) {
+ if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_body && $c->stash->{external_source_id}) {
$report_uri = $c->uri_for( '/report', $report->id, undef, { external_source_id => $c->stash->{external_source_id} } );
} else {
$report_uri = $c->cobrand->base_url_for_report( $report ) . $report->url;
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index da4cc33ca..c3843c9af 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -76,7 +76,7 @@ sub update_problem : Private {
$problem->state('confirmed');
}
- if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_council && $c->req->param('external_source_id') ) {
+ if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_body && $c->req->param('external_source_id') ) {
$problem->interest_count( \'interest_count + 1' );
}
@@ -201,7 +201,7 @@ sub process_update : Private {
if ( $params{state} ) {
$params{state} = 'fixed - council'
- if $params{state} eq 'fixed' && $c->user && $c->user->belongs_to_council( $update->problem->council );
+ if $params{state} eq 'fixed' && $c->user && $c->user->belongs_to_body( $update->problem->council );
$update->problem_state( $params{state} );
}
@@ -246,7 +246,7 @@ sub check_for_errors : Private {
# they have to be an authority user to update the state
if ( $c->req->param('state') ) {
my $error = 0;
- $error = 1 unless $c->user && $c->user->belongs_to_council( $c->stash->{update}->problem->council );
+ $error = 1 unless $c->user && $c->user->belongs_to_body( $c->stash->{update}->problem->council );
my $state = $c->req->param('state');
$error = 1 unless ( grep { $state eq $_ } ( qw/confirmed closed fixed investigating planned/, 'in progress', 'fixed', 'fixed - user', 'fixed - council' ) );
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 46ec47d9e..808959784 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -684,7 +684,7 @@ sub example_places {
=head2 only_authed_can_create
-If true, only users with the from_council flag set are able to create reports.
+If true, only users with the from_body flag set are able to create reports.
=cut
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 1baf15ad1..62bea1dd4 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -26,7 +26,7 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 1 },
"password",
{ data_type => "text", default_value => "", is_nullable => 0 },
- "from_council",
+ "from_body",
{ data_type => "integer", is_nullable => 1 },
"flagged",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
@@ -61,8 +61,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-10 15:34:40
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6KOp2hcVLqx28Po7uENTnA
+# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-12 13:06:09
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L6gtjOQeVkebGUIHJcHuUA
__PACKAGE__->add_columns(
"password" => {
@@ -144,16 +144,17 @@ sub alert_for_problem {
} );
}
-sub council {
+sub body {
my $self = shift;
- return '' unless $self->from_council;
+ return '' unless $self->from_body;
- my $key = 'council_name:' . $self->from_council;
+ my $key = 'body_name:' . $self->from_body;
my $result = Memcached::get($key);
+ ### TODO: Add a 'name' column to body which is used instead of calling mapit
unless ($result) {
- my $area_info = mySociety::MaPit::call('area', $self->from_council);
+ my $area_info = mySociety::MaPit::call('area', $self->from_body);
$result = $area_info->{name};
Memcached::set($key, $result, 86400);
}
@@ -161,21 +162,21 @@ sub council {
return $result;
}
-=head2 belongs_to_council
+=head2 belongs_to_body
- $belongs_to_council = $user->belongs_to_council( $council_list );
+ $belongs_to_body = $user->belongs_to_body( $council_list );
Returns true if the user belongs to the comma seperated list of council ids passed in
=cut
-sub belongs_to_council {
+sub belongs_to_body {
my $self = shift;
my $council = shift;
my %councils = map { $_ => 1 } split ',', $council;
- return 1 if $self->from_council && $councils{ $self->from_council };
+ return 1 if $self->from_body && $councils{ $self->from_body };
return 0;
}