aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/update-schema1
-rw-r--r--db/downgrade_0046---0045.sql6
-rw-r--r--db/schema.sql3
-rw-r--r--db/schema_0046-user-add-extra.sql6
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm7
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm1
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm28
-rw-r--r--perllib/FixMyStreet/Script/Reports.pm9
-rw-r--r--t/app/controller/report_inspect.t22
-rw-r--r--t/app/controller/rss.t1
-rw-r--r--t/app/sendreport/inspection_required.t32
-rw-r--r--templates/web/base/admin/category_edit.html11
-rw-r--r--templates/web/base/admin/user-form.html8
-rw-r--r--templates/web/base/report/_main.html2
-rw-r--r--templates/web/base/report/display_tools.html4
-rw-r--r--templates/web/base/report/update.html2
-rw-r--r--templates/web/bristol/footer_extra_js.html1
-rw-r--r--templates/web/bristol/maps/bristol.html1
-rwxr-xr-xtemplates/web/fixmystreet.com/about/privacy.html53
-rw-r--r--templates/web/fixmystreet.com/header_extra.html2
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js2
-rw-r--r--web/js/OpenLayers.Projection.OrdnanceSurvey.js4
-rw-r--r--web/js/fixmystreet-admin.js10
24 files changed, 186 insertions, 33 deletions
diff --git a/bin/update-schema b/bin/update-schema
index bb0360fb2..500e771f1 100755
--- a/bin/update-schema
+++ b/bin/update-schema
@@ -194,6 +194,7 @@ else {
# By querying the database schema, we can see where we're currently at
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
+ return '0046' if column_exists('users', 'extra');
return '0045' if table_exists('response_priorities');
return '0044' if table_exists('contact_response_templates');
return '0043' if column_exists('users', 'area_id');
diff --git a/db/downgrade_0046---0045.sql b/db/downgrade_0046---0045.sql
new file mode 100644
index 000000000..c0cc566af
--- /dev/null
+++ b/db/downgrade_0046---0045.sql
@@ -0,0 +1,6 @@
+BEGIN;
+
+ALTER TABLE users
+ DROP COLUMN extra;
+
+COMMIT;
diff --git a/db/schema.sql b/db/schema.sql
index 27f4bad13..fe45fb4aa 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -31,7 +31,8 @@ create table users (
title text,
twitter_id bigint unique,
facebook_id bigint unique,
- area_id integer
+ area_id integer,
+ extra text
);
-- Record details of reporting bodies, including open311 configuration details
diff --git a/db/schema_0046-user-add-extra.sql b/db/schema_0046-user-add-extra.sql
new file mode 100644
index 000000000..06937237c
--- /dev/null
+++ b/db/schema_0046-user-add-extra.sql
@@ -0,0 +1,6 @@
+BEGIN;
+
+ALTER TABLE users
+ ADD COLUMN extra TEXT;
+
+COMMIT;
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 46ac10d36..8ec9eeaab 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -385,6 +385,9 @@ sub update_contacts : Private {
else {
$contact->unset_extra_metadata( 'inspection_required' );
}
+ if ( $c->get_param('reputation_threshold') ) {
+ $contact->set_extra_metadata( reputation_threshold => int($c->get_param('reputation_threshold')) );
+ }
if ( %errors ) {
$c->stash->{updated} = _('Please correct the errors below');
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 355a3f2a9..db3b16dcd 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -270,6 +270,8 @@ sub delete :Local :Args(1) {
$p->lastupdate( \'current_timestamp' );
$p->update;
+ $p->user->update_reputation(-1);
+
$c->model('DB::AdminLog')->create( {
admin_user => $c->user->email,
object_type => 'problem',
@@ -316,6 +318,7 @@ sub inspect : Private {
my $valid = 1;
my $update_text;
+ my $reputation_change = 0;
if ($permissions->{report_inspect}) {
foreach (qw/detailed_information traffic_information/) {
@@ -326,6 +329,7 @@ sub inspect : Private {
$update_text = Utils::cleanup_text( $c->get_param('public_update'), { allow_multiline => 1 } );
if ($update_text) {
$problem->set_extra_metadata( inspected => 1 );
+ $reputation_change = 1;
} else {
$valid = 0;
$c->stash->{errors} ||= [];
@@ -371,6 +375,9 @@ sub inspect : Private {
}
if ($valid) {
+ if ( $reputation_change != 0 ) {
+ $problem->user->update_reputation($reputation_change);
+ }
$problem->update;
if ( defined($update_text) ) {
$problem->add_to_comments( {
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index 183b233a8..28f1aba43 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -207,6 +207,7 @@ sub generate : Private {
$out =~ s{(<link>.*?</link>)}{$1<uri>$uri</uri>};
$c->response->header('Content-Type' => 'application/xml; charset=utf-8');
+ $c->response->header('Access-Control-Allow-Origin' => '*');
$c->response->body( $out );
}
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 2a2d0d5e3..8d42d5926 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -26,20 +26,22 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 1 },
"password",
{ data_type => "text", default_value => "", is_nullable => 0 },
- "flagged",
- { data_type => "boolean", default_value => \"false", is_nullable => 0 },
"from_body",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
+ "flagged",
+ { data_type => "boolean", default_value => \"false", is_nullable => 0 },
"title",
{ data_type => "text", is_nullable => 1 },
- "facebook_id",
- { data_type => "bigint", is_nullable => 1 },
"twitter_id",
{ data_type => "bigint", is_nullable => 1 },
+ "facebook_id",
+ { data_type => "bigint", is_nullable => 1 },
"is_superuser",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"area_id",
{ data_type => "integer", is_nullable => 1 },
+ "extra",
+ { data_type => "text", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint("users_email_key", ["email"]);
@@ -100,11 +102,17 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-08-03 13:52:28
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SX8BS91mWHoOm2oWdNth1w
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-09-16 14:22:10
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7wfF1VnZax2QTXCIPXr+vg
+
+__PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn");
+__PACKAGE__->rabx_column('extra');
use Moo;
use mySociety::EmailUtil;
+use namespace::clean -except => [ 'meta' ];
+
+with 'FixMyStreet::Roles::Extra';
__PACKAGE__->many_to_many( planned_reports => 'user_planned_reports', 'report' );
@@ -370,4 +378,12 @@ sub is_planned_report {
return $self->active_planned_reports->find({ id => $problem->id });
}
+sub update_reputation {
+ my ( $self, $change ) = @_;
+
+ my $reputation = $self->get_extra_metadata('reputation') || 0;
+ $self->set_extra_metadata( reputation => $reputation + $change);
+ $self->update;
+}
+
1;
diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm
index 8d3b2ddbc..7d614bc30 100644
--- a/perllib/FixMyStreet/Script/Reports.pm
+++ b/perllib/FixMyStreet/Script/Reports.pm
@@ -145,9 +145,16 @@ sub send(;$) {
my $inspection_required = $sender_info->{contact}->get_extra_metadata('inspection_required') if $sender_info->{contact};
if ( $inspection_required ) {
+ my $reputation_threshold = $sender_info->{contact}->get_extra_metadata('reputation_threshold') || 0;
+ my $reputation_threshold_met = 0;
+ if ( $reputation_threshold > 0 ) {
+ my $user_reputation = $row->user->get_extra_metadata('reputation') || 0;
+ $reputation_threshold_met = $user_reputation >= $reputation_threshold;
+ }
unless (
$row->get_extra_metadata('inspected') ||
- $row->user->has_permission_to( trusted => $row->bodies_str_ids )
+ $row->user->has_permission_to( trusted => $row->bodies_str_ids ) ||
+ $reputation_threshold_met
) {
$skip = 1;
debug_print("skipped because not yet inspected", $row->id) if $debug_mode;
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index 4caeef501..831959fff 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -6,8 +6,8 @@ use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
-my $brum = $mech->create_body_ok(2514, 'Birmingham City Council');
-my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council');
+my $brum = $mech->create_body_ok(2514, 'Birmingham City Council', id => 2514);
+my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council', id => 2237);
my $contact = $mech->create_contact_ok( body_id => $oxon->id, category => 'Cows', email => 'cows@example.net' );
my $rp = FixMyStreet::DB->resultset("ResponsePriority")->create({
body => $oxon,
@@ -55,11 +55,13 @@ FixMyStreet::override_config {
subtest "test inspect & instruct submission" => sub {
$report->unset_extra_metadata('inspected');
$report->update;
+ my $reputation = $report->user->get_extra_metadata("reputation");
$mech->get_ok("/report/$report_id/inspect");
$mech->submit_form_ok({ button => 'save', with_fields => { public_update => "This is a public update.", save_inspected => "1" } });
$report->discard_changes;
is $report->comments->first->text, "This is a public update.", 'Update was created';
is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected';
+ is $report->user->get_extra_metadata('reputation'), $reputation+1, "User reputation was increased";
};
subtest "test update is required when instructing" => sub {
@@ -107,6 +109,22 @@ FixMyStreet::override_config {
}
};
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ ALLOWED_COBRANDS => 'oxfordshire',
+}, sub {
+ subtest "test negative reputation" => sub {
+ my $reputation = $report->user->get_extra_metadata("reputation");
+
+ $mech->get_ok("/report/$report_id");
+ $mech->submit_form( button => 'remove_from_site' );
+
+ $report->discard_changes;
+ is $report->user->get_extra_metadata('reputation'), $reputation-1, "User reputation was decreased";
+ };
+};
+
+
END {
$mech->delete_body($oxon);
$mech->delete_body($brum);
diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t
index 8b39219fa..4f737dda7 100644
--- a/t/app/controller/rss.t
+++ b/t/app/controller/rss.t
@@ -50,6 +50,7 @@ FixMyStreet::override_config {
};
$mech->content_contains( "Testing, 10th October" );
$mech->content_lacks( 'Nearest road to the pin' );
+is $mech->response->header('Access-Control-Allow-Origin'), '*';
$report->geocode(
{
diff --git a/t/app/sendreport/inspection_required.t b/t/app/sendreport/inspection_required.t
index 88a48e991..f9d40d39f 100644
--- a/t/app/sendreport/inspection_required.t
+++ b/t/app/sendreport/inspection_required.t
@@ -69,6 +69,38 @@ subtest 'Uninspected report is sent when made by trusted user' => sub {
$report->discard_changes;
$mech->email_count_is( 1 );
ok $report->whensent, 'Report marked as sent';
+ is $report->get_extra_metadata('inspected'), undef, 'Report not marked as inspected';
+};
+
+subtest 'Uninspected report isn’t sent when user rep is too low' => sub {
+ $mech->clear_emails_ok;
+ $report->whensent( undef );
+ $report->update;
+
+ $user->user_body_permissions->delete;
+ $user->set_extra_metadata(reputation => 15);
+ $user->update;
+
+ $contact->set_extra_metadata(reputation_threshold => 20);
+ $contact->update;
+
+ FixMyStreet::DB->resultset('Problem')->send_reports();
+
+ $report->discard_changes;
+ $mech->email_count_is( 0 );
+ is $report->whensent, undef, 'Report hasn’t been sent';
+};
+
+subtest 'Uninspected report is sent when user rep is high enough' => sub {
+ $user->set_extra_metadata(reputation => 21);
+ $user->update;
+
+ FixMyStreet::DB->resultset('Problem')->send_reports();
+
+ $report->discard_changes;
+ $mech->email_count_is( 1 );
+ ok $report->whensent, 'Report marked as sent';
+ is $report->get_extra_metadata('inspected'), undef, 'Report not marked as inspected';
};
done_testing();
diff --git a/templates/web/base/admin/category_edit.html b/templates/web/base/admin/category_edit.html
index 7fe1a10d3..7cc45f80f 100644
--- a/templates/web/base/admin/category_edit.html
+++ b/templates/web/base/admin/category_edit.html
@@ -19,7 +19,7 @@
[% END %]
</p>
-<form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
+<form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" id="category_edit">
<p><strong>[% loc('Category:') %] </strong>[% contact.category | html %]
<input type="hidden" name="category" value="[% contact.category | html %]" >
<input type="hidden" name="token" value="[% csrf_token %]" >
@@ -47,6 +47,15 @@
[% END %]
</p>
+ [% IF c.cobrand.moniker != 'zurich' %]
+ <p [% 'class=hidden' UNLESS contact.get_extra_metadata('inspection_required') %]>
+ <label>
+ [% loc('Reputation threshold:') %]
+ <input type="text" name="reputation_threshold" id="reputation_threshold" value="[% contact.get_extra_metadata('reputation_threshold') | html %]" size="30">
+ </label>
+ </p>
+ [% END %]
+
<p><strong>[% loc('Note:') %] </strong><textarea name="note" rows="3" cols="40"></textarea>
[% IF body.can_be_devolved %]
diff --git a/templates/web/base/admin/user-form.html b/templates/web/base/admin/user-form.html
index 1dfd35cee..5adc200a1 100644
--- a/templates/web/base/admin/user-form.html
+++ b/templates/web/base/admin/user-form.html
@@ -110,6 +110,14 @@
</label>
[% END %]
</li>
+ <li>
+ <div class="admin-hint">
+ <p>
+ [% loc("Reports from users with high enough reputation will be sent immediately without requiring inspection. Each category's threshold can be managed on its edit page. Users earn reputation when a report they have made is marked as inspected by inspectors.") %]
+ </p>
+ </div>
+ [% loc('Reputation:') %] [% user.get_extra_metadata('reputation') %]
+ </li>
[% END %]
[% IF c.user.is_superuser %]
diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html
index 20982c30c..469ee5bc5 100644
--- a/templates/web/base/report/_main.html
+++ b/templates/web/base/report/_main.html
@@ -126,7 +126,7 @@
%]
<div class="moderate-display segmented-control" role="menu">
[% IF permissions.moderate %]
- <a class="btn" id="moderate-report" role="menuitem" aria-label="[% loc('Moderate this report') %]">[% loc('Moderate') %]</a>
+ <a class="js-moderate btn" role="menuitem" aria-label="[% loc('Moderate this report') %]">[% loc('Moderate') %]</a>
[% END %]
[% IF !hide_inspect_button AND permissions.keys.grep('report_inspect|report_edit_category|report_edit_priority').size %]
<a class="btn" href="/report/[% problem.id %]/inspect#side-inspect" role="menuitem">
diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html
index 5279829e9..f27ed8da5 100644
--- a/templates/web/base/report/display_tools.html
+++ b/templates/web/base/report/display_tools.html
@@ -3,7 +3,7 @@
[% IF c.user_exists AND c.cobrand.users_can_hide AND c.user.belongs_to_body( problem.bodies_str ) %]
<li><form method="post" action="/report/delete/[% problem.id %]" id="remove-from-site-form">
<input type="hidden" name="token" value="[% csrf_token %]">
- <input type="submit" id="key-tool-report-abuse" class="abuse btn" data-confirm="[% loc('Are you sure?') %]" value="[% loc('Remove from site') %]">
+ <input type="submit" id="key-tool-report-abuse" class="abuse btn" data-confirm="[% loc('Are you sure?') %]" name="remove_from_site" value="[% loc('Remove from site') %]">
</form></li>
[% ELSIF c.cobrand.moniker != 'zurich' %]
<li><a rel="nofollow" id="key-tool-report-abuse" class="abuse" href="[% c.uri_for( '/contact', { id => problem.id } ) %]">[% loc('Report abuse' ) %]</a></li>
@@ -43,7 +43,9 @@
<fieldset>
<label class="hidden n" for="alert_rznvy">[% loc('Your email') %]</label>
<div class="form-txt-submit-box">
+ [% IF NOT c.user_exists %]
<input type="email" class="form-control" name="rznvy" id="alert_rznvy" value="[% email | html %]" size="30" placeholder="[% loc('Your email') %]">
+ [% END %]
<input class="green-btn" type="submit" value="[% loc('Subscribe') %]">
</div>
<input type="hidden" name="token" value="[% csrf_token %]">
diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html
index 0c85c132b..7c2c39eb2 100644
--- a/templates/web/base/report/update.html
+++ b/templates/web/base/report/update.html
@@ -9,7 +9,7 @@
[% IF moderating; original_update = update.moderation_original_data %]
<form method="post" action="/moderate/report/[% problem.id %]/update/[% update.id %]">
<input type="hidden" name="token" value="[% csrf_token %]">
- <input type="button" class="btn moderate moderate-display" value="Moderate this update">
+ <input type="button" class="btn js-moderate moderate-display" value="Moderate this update">
<div class="moderate-edit">
<label><input type="checkbox" class="hide-document" name="update_hide">
Hide update completely?</label>
diff --git a/templates/web/bristol/footer_extra_js.html b/templates/web/bristol/footer_extra_js.html
deleted file mode 100644
index cf8fa7301..000000000
--- a/templates/web/bristol/footer_extra_js.html
+++ /dev/null
@@ -1 +0,0 @@
-<script src="[% version('/cobrands/fixmystreet-uk-councils/js.js') %]"></script>
diff --git a/templates/web/bristol/maps/bristol.html b/templates/web/bristol/maps/bristol.html
index 42cb86bf2..7a4a5fbcf 100644
--- a/templates/web/bristol/maps/bristol.html
+++ b/templates/web/bristol/maps/bristol.html
@@ -1,6 +1,5 @@
[% map_js = BLOCK %]
<script type="text/javascript" src="[% version('/js/OpenLayers.2.11.zurich.js') %]"></script>
-<script type="text/javascript" src="[% version('/js/OpenLayers.Projection.OrdnanceSurvey.js') %]"></script>
<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script>
<script type="text/javascript" src="[% version('/js/map-wmts-base.js') %]"></script>
<script type="text/javascript" src="[% version('/js/map-wmts-bristol.js') %]"></script>
diff --git a/templates/web/fixmystreet.com/about/privacy.html b/templates/web/fixmystreet.com/about/privacy.html
index 2492eee89..8b06d8726 100755
--- a/templates/web/fixmystreet.com/about/privacy.html
+++ b/templates/web/fixmystreet.com/about/privacy.html
@@ -75,7 +75,9 @@ the cookies and services that this site can use.
<p>We use Google Analytics to collect information about how people use this
site. We do this to make sure it’s meeting its users’ needs and to understand
-how we could do it better. Google Analytics stores information such as what
+how we could do it better.
+
+<p>Google Analytics stores information such as what
pages you visit, how long you are on the site, how you got here, what you click
on, and information about your web browser. IP addresses are masked (only a
portion is stored) and personal information is only reported in aggregate. We
@@ -83,18 +85,25 @@ do not allow Google to use or share our analytics data for any purpose besides
providing us with analytics information, and we recommend that any user of
Google Analytics does the same.
-<p>If you’re unhappy with data about your visit to be used in this way, you can
-install the <a href="http://tools.google.com/dlpage/gaoptout">official browser
-plugin for blocking Google Analytics</a>.
-
-<p>The cookies set by Google Analytics are as follows:
-
-<table cellpadding=5>
-<tr align="left"><th scope="col">Name</th><th scope="col">Typical Content</th><th scope="col">Expires</th></tr>
-<tr><td>_ga</td><td>Used to distinguish users</td><td>2 years</td></tr>
-<tr><td>_gat</td><d>Used to throtle request rate</td><td>10 minutes</td></tr>
-<tr><td>__utmx / __utmxx</td><td>Which variation of a page you are seeing if we are testing different versions to see which is best</td><td>2&nbsp;years</td></tr>
-</table>
+<p>We have also enabled the Advertising Features of Google
+Analytics. In particular, we use <b>Demographics and Interest
+reporting</b> to identify trends in the types of users visiting our
+site, which may be used for internal reporting and improvement of
+the site content.
+
+<p>In technical speak, this allows Google to collect data about your
+traffic via Google
+<a href="https://www.google.com/policies/technologies/types/">advertising
+cookies</a> and
+<a href="https://www.google.com/policies/privacy/key-terms/#toc-terms-identifier">anonymous
+identifiers</a>, in addition to data collected through a standard
+Google Analytics implementation. Regardless of the source of the
+data, we strictly adhere to
+<a href="https://support.google.com/analytics/answer/2700409">Google&rsquo;s
+policy requirements</a> in our treatment of your data. We do not
+facilitate the merging of personally-identifiable information with
+non-personally identifiable information collected through any Google
+advertising product or feature.
<h4>Google’s Official Statement about Analytics Data</h4>
@@ -115,8 +124,22 @@ this you may not be able to use the full functionality of this website. By
using this website, you consent to the processing of data about you by Google
in the manner and for the purposes set out above.”</p>
-<p><a href="https://www.mysociety.org/privacy-online/">More general information
-on how third party services work</a></p>
+<h3>Opting out</h3>
+<p>If you’re unhappy with the idea of sharing the fact you
+visited our site (and any other sites) with Google, you can
+<a href="https://tools.google.com/dlpage/gaoptout/">install the
+official browser plugin for blocking Google Analytics</a>.
+
+<p>If you want to disable advertising-based tracking, you can
+<a href="https://www.google.com/settings/ads">adjust your Google Ads
+Settings</a>, or opt out of advertising-based tracking across a
+number of providers in one go using the
+<a href="http://www.networkadvertising.org/choices/">Network
+Advertising Initiative’s opt-out form</a>.
+
+<p>Rest assured, we only track usage data for one reason: to help us
+understand how we can make the site work better for you, our
+users.
<h2>Credits</h2>
diff --git a/templates/web/fixmystreet.com/header_extra.html b/templates/web/fixmystreet.com/header_extra.html
index 1bccf08d1..4ea87a5e1 100644
--- a/templates/web/fixmystreet.com/header_extra.html
+++ b/templates/web/fixmystreet.com/header_extra.html
@@ -20,7 +20,7 @@
[% IF c.config.BASE_URL == "https://www.fixmystreet.com" AND not admin AND NOT c.req.header('User-Agent').match('Google Page Speed') %]
<script src="//www.google-analytics.com/cx/api.js?experiment=ZwMlZkAhSbK_tP_QG64QrQ"></script>
<script nonce="[% csp_nonce %]">
-var variation = cxApi.chooseVariation(),
+var variation = typeof cxApi !== "undefined" ? cxApi.chooseVariation() : 0,
docElement = document.documentElement,
className = docElement.className;
if (!/about\/council/.test(location.pathname)) {
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 4d222dc24..4aeb14d88 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -833,7 +833,7 @@ $.extend(fixmystreet.set_up, {
function add_handlers (elem, word) {
elem.each( function () {
var $elem = $(this);
- $elem.find('#moderate-report').on('click', function () {
+ $elem.find('.js-moderate').on('click', function () {
$elem.find('.moderate-display').hide();
$elem.find('.moderate-edit').show();
});
diff --git a/web/js/OpenLayers.Projection.OrdnanceSurvey.js b/web/js/OpenLayers.Projection.OrdnanceSurvey.js
index bb596d3bf..85574d8e0 100644
--- a/web/js/OpenLayers.Projection.OrdnanceSurvey.js
+++ b/web/js/OpenLayers.Projection.OrdnanceSurvey.js
@@ -39,6 +39,8 @@
*
*/
+if (typeof OpenLayers !== "undefined") {
+
OpenLayers.Projection.OS = {
/**
@@ -487,3 +489,5 @@ OpenLayers.Projection.addTransform("EPSG:900913", "EPSG:27700",
OpenLayers.Projection.OS.goog2osgb);
OpenLayers.Projection.addTransform("EPSG:27700", "EPSG:900913",
OpenLayers.Projection.OS.osgb2goog);
+
+}
diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js
index aa79a9b46..6f4580feb 100644
--- a/web/js/fixmystreet-admin.js
+++ b/web/js/fixmystreet-admin.js
@@ -79,5 +79,15 @@ $(function(){
var show_area = $(this).val() == $(this).find("[data-originally-selected]").val();
$("form#user_edit select#area_id").closest("li").toggle(show_area);
});
+
+ // On category edit page, hide the reputation input if inspection isn't required
+ $("form#category_edit #inspection_required").change(function() {
+ var $p = $("form#category_edit #reputation_threshold").closest("p");
+ if (this.checked) {
+ $p.removeClass("hidden");
+ } else {
+ $p.addClass("hidden");
+ }
+ });
});