aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md16
-rw-r--r--bin/site-specific-install.sh2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm31
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm11
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm2
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm22
-rw-r--r--t/app/controller/contact.t2
-rw-r--r--t/app/controller/report_inspect.t4
-rw-r--r--templates/web/base/contact/index.html8
-rw-r--r--templates/web/base/contact/unsuitable-text.html3
-rw-r--r--templates/web/base/report/_inspect.html8
-rw-r--r--templates/web/base/report/display_tools.html4
-rw-r--r--templates/web/base/reports/_list-filters.html4
-rw-r--r--templates/web/fixmystreet.com/contact/unsuitable-text.html7
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js13
-rw-r--r--web/cobrands/sass/_base.scss2
16 files changed, 106 insertions, 33 deletions
diff --git a/README.md b/README.md
index 08c57675c..95a8f03dd 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,22 @@ web-based cross-browser testing tools for this project.
## Releases
+* v2.0.1 (16th December 2016)
+ - Bugfixes:
+ - Fix issue in dragging map in Chrome 55. openlayers/ol2#1510
+ - Don't double-decode strftime output, to fix date/time display.
+ - Filter category should always carry through to form.
+ - Don't fix height of admin multiple selects. #1589
+ - Admin improvements:
+ - Add duplicate management to inspector view. #1581
+ - Open inspect Navigate link in new tab. #1583
+ - Scroll to report inspect form if present. #1583
+ - Update problem lastupdate column on inspect save. #1584
+ - Update priorities in inspect form on category change. #1590
+ - Development improvements:
+ - Pass test if NXDOMAINs are intercepted.
+ - Better path for showing config git version. #1586
+
* v2.0 (15th November 2016)
- Front end improvements:
- Add HTML emails. #1281 #1103
diff --git a/bin/site-specific-install.sh b/bin/site-specific-install.sh
index 6c54b51d0..007cd1839 100644
--- a/bin/site-specific-install.sh
+++ b/bin/site-specific-install.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Set this to the version we want to check out
-VERSION=${VERSION_OVERRIDE:-v2.0}
+VERSION=${VERSION_OVERRIDE:-v2.0.1}
PARENT_SCRIPT_URL=https://github.com/mysociety/commonlib/blob/master/bin/install-site.sh
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 481bc4ab8..3c251a5cb 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -308,6 +308,28 @@ sub inspect : Private {
$c->stash->{categories} = $c->forward('/admin/categories_for_point');
$c->stash->{report_meta} = { map { $_->{name} => $_ } @{ $c->stash->{problem}->get_extra_fields() } };
+ my %category_body = map { $_->category => $_->body_id } map { $_->contacts->all } values %{$problem->bodies};
+
+ my @priorities = $c->model('DB::ResponsePriority')->for_bodies($problem->bodies_str_ids)->all;
+ my $priorities_by_category = {};
+ foreach my $pri (@priorities) {
+ my $any = 0;
+ foreach ($pri->contacts->all) {
+ $any = 1;
+ push @{$priorities_by_category->{$_->category}}, $pri->id . '=' . URI::Escape::uri_escape_utf8($pri->name);
+ }
+ if (!$any) {
+ foreach (grep { $category_body{$_} == $pri->body_id } @{$c->stash->{categories}}) {
+ push @{$priorities_by_category->{$_}}, $pri->id . '=' . URI::Escape::uri_escape_utf8($pri->name);
+ }
+ }
+ }
+ foreach (keys %{$priorities_by_category}) {
+ $priorities_by_category->{$_} = join('&', @{$priorities_by_category->{$_}});
+ }
+
+ $c->stash->{priorities_by_category} = $priorities_by_category;
+
if ( $c->get_param('save') ) {
$c->forward('/auth/check_csrf_token');
@@ -355,10 +377,6 @@ sub inspect : Private {
}
}
- if ($c->get_param('priority') && ($permissions->{report_inspect} || $permissions->{report_edit_priority})) {
- $problem->response_priority( $problem->response_priorities->find({ id => $c->get_param('priority') }) );
- }
-
if ( !$c->forward( '/admin/report_edit_location', [ $problem ] ) ) {
# New lat/lon isn't valid, show an error
$valid = 0;
@@ -378,6 +396,11 @@ sub inspect : Private {
$c->forward('/report/new/set_report_extras', [ \@contacts, $param_prefix ]);
}
+ # Updating priority must come after category, in case category has changed (and so might have priorities)
+ if ($c->get_param('priority') && ($permissions->{report_inspect} || $permissions->{report_edit_priority})) {
+ $problem->response_priority( $problem->response_priorities->find({ id => $c->get_param('priority') }) );
+ }
+
if ($valid) {
if ( $reputation_change != 0 ) {
$problem->user->update_reputation($reputation_change);
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index ec1534fe9..203e72fae 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -681,16 +681,7 @@ alphabetical order of name.
sub response_priorities {
my $self = shift;
- return $self->result_source->schema->resultset('ResponsePriority')->search(
- {
- 'me.body_id' => $self->bodies_str_ids,
- 'contact.category' => [ $self->category, undef ],
- },
- {
- order_by => 'name',
- join => { 'contact_response_priorities' => 'contact' },
- }
- );
+ return $self->result_source->schema->resultset('ResponsePriority')->for_bodies($self->bodies_str_ids, $self->category);
}
# returns true if the external id is the council's ref, i.e., useful to publish it
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 028394795..f4e5144f8 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -268,7 +268,7 @@ sub has_permission_to {
my ($self, $permission_type, $body_ids) = @_;
return 1 if $self->is_superuser;
- return 0 unless $body_ids;
+ return 0 if !$body_ids || (ref $body_ids && !@$body_ids);
my $permission = $self->user_body_permissions->find({
permission_type => $permission_type,
diff --git a/perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm b/perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm
new file mode 100644
index 000000000..aa9c426f4
--- /dev/null
+++ b/perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm
@@ -0,0 +1,22 @@
+package FixMyStreet::DB::ResultSet::ResponsePriority;
+use base 'DBIx::Class::ResultSet';
+
+use strict;
+use warnings;
+
+sub for_bodies {
+ my ($rs, $bodies, $category) = @_;
+ my $attrs = {
+ 'me.body_id' => $bodies,
+ };
+ if ($category) {
+ $attrs->{'contact.category'} = [ $category, undef ];
+ }
+ $rs->search($attrs, {
+ order_by => 'name',
+ join => { 'contact_response_priorities' => 'contact' },
+ distinct => 1,
+ });
+}
+
+1;
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index aabf915ad..7c2769b9c 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -99,7 +99,7 @@ for my $test (
$mech->content_contains( $test->{update}->{text} );
} else {
$mech->get_ok( '/contact?id=' . $problem->id );
- $mech->content_contains('Does this report break our');
+ $mech->content_contains('reporting the following problem');
$mech->content_contains( $test->{title} );
$mech->content_contains( $test->{meta} );
}
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index 70b8c9586..1f11829b7 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -157,8 +157,8 @@ FixMyStreet::override_config {
$user->user_body_permissions->delete;
$user->user_body_permissions->create({ body => $oxon, permission_type => $test->{type} });
$mech->get_ok("/report/$report_id");
- $mech->contains_or_lacks($test->{priority}, 'Priority');
- $mech->contains_or_lacks($test->{priority}, 'High');
+ $mech->contains_or_lacks($test->{priority}, 'Priority</label>');
+ $mech->contains_or_lacks($test->{priority}, '>High');
$mech->contains_or_lacks($test->{category}, 'Category');
$mech->contains_or_lacks($test->{detailed}, 'Extra details');
$mech->submit_form_ok({
diff --git a/templates/web/base/contact/index.html b/templates/web/base/contact/index.html
index a66d183b6..f24f8afea 100644
--- a/templates/web/base/contact/index.html
+++ b/templates/web/base/contact/index.html
@@ -40,16 +40,12 @@
<input type="hidden" name="id" value="[% update.problem_id %]">
[% ELSIF problem %]
- <p>
[% IF moderation_complaint %]
<input type="hidden" name="m" value="[% moderation_complaint %]">
- [% loc('You are complaining that this problem report was unnecessarily moderated:') %]
+ <p>[% loc('You are complaining that this problem report was unnecessarily moderated:') %]</p>
[% ELSE %]
- [% loc('Does this report break our <a href="/about/house-rules">House Rules</a>? Use this form to let us know.') %]
- </p> <p>
- <strong>[% loc('If you are trying to make a new report, please <a href="/">go to the front page</a> and follow the instructions.') %]</strong>
+ [% INCLUDE 'contact/unsuitable-text.html' %]
[% END %]
- </p>
<blockquote>
<h2>[% problem.title_safe | html %]</h2>
diff --git a/templates/web/base/contact/unsuitable-text.html b/templates/web/base/contact/unsuitable-text.html
new file mode 100644
index 000000000..12137c818
--- /dev/null
+++ b/templates/web/base/contact/unsuitable-text.html
@@ -0,0 +1,3 @@
+<p>
+ [% loc('You are reporting the following problem report for being abusive, containing personal information, or similar:') %]
+</p>
diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html
index ba11bbcbd..84170a38c 100644
--- a/templates/web/base/report/_inspect.html
+++ b/templates/web/base/report/_inspect.html
@@ -52,11 +52,11 @@
[% cat_prefix = category | lower | replace('[^a-z]', '') %]
[% cat_prefix = "category_" _ cat_prefix _ "_" %]
[% IF category == problem.category %]
- <p data-category="[% category | html %]">
+ <p data-category="[% category | html %]" data-priorities="[% priorities_by_category.$category %]">
[% INCLUDE 'report/new/category_extras_fields.html' %]
</p>
- [% ELSIF category_extras.$category.size %]
- <p data-category="[% category | html %]" class="hidden">
+ [% ELSE %]
+ <p data-category="[% category | html %]" class="hidden" data-priorities="[% priorities_by_category.$category %]">
[% INCLUDE 'report/new/category_extras_fields.html' report_meta='' %]
</p>
[% END %]
@@ -107,7 +107,7 @@
<select name="priority" id="problem_priority" class="form-control">
<option value="" [% 'selected' UNLESS problem.response_priority_id %]>-</option>
[% FOREACH priority IN problem.response_priorities %]
- <option value="[% priority.id %]" [% 'selected' IF problem.response_priority_id == priority.id %] [% 'disabled' IF priority.deleted %]>[% priority.name %]</option>
+ <option value="[% priority.id %]" [% 'selected' IF problem.response_priority_id == priority.id %] [% 'disabled' IF priority.deleted %]>[% priority.name | html %]</option>
[% END %]
</select>
</p>
diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html
index 8a756a948..fb337df59 100644
--- a/templates/web/base/report/display_tools.html
+++ b/templates/web/base/report/display_tools.html
@@ -6,7 +6,9 @@
<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('Unsuitable?' ) %]</a></li>
+ <li><a rel="nofollow" id="key-tool-report-abuse" class="abuse" href="[% c.uri_for( '/contact', { id => problem.id } ) %]">[%
+ c.cobrand.moniker == 'fixmystreet' ? 'Unsuitable?' : loc('Report abuse')
+ %]</a></li>
[% END %]
[% IF c.cobrand.moniker != 'zurich' %]
<li><a rel="nofollow" id="key-tool-report-updates" class="feed" href="[% c.uri_for( '/alert/subscribe', { id => problem.id } ) %]">[% loc('Get updates' ) %]</a></li>
diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html
index 5ca483a1f..9c2a74e57 100644
--- a/templates/web/base/reports/_list-filters.html
+++ b/templates/web/base/reports/_list-filters.html
@@ -1,5 +1,5 @@
[% select_status = BLOCK %]
- <select class="form-control" name="status" id="statuses" multiple data-all="[% loc('All reports') %]">
+ <select class="form-control js-multiple" name="status" id="statuses" multiple data-all="[% loc('All reports') %]">
<option value="open"[% ' selected' IF filter_status.open %]>[% loc('Unfixed reports') %]</option>
<option value="closed"[% ' selected' IF filter_status.closed %]>[% loc('Closed reports') %]</option>
<option value="fixed"[% ' selected' IF filter_status.fixed %]>[% loc('Fixed reports') %]</option>
@@ -8,7 +8,7 @@
[% select_category = BLOCK %]
[% IF filter_categories.size %]
- <select class="form-control" name="filter_category" id="filter_categories" multiple data-all="[% loc('Everything') %]">
+ <select class="form-control js-multiple" name="filter_category" id="filter_categories" multiple data-all="[% loc('Everything') %]">
[% FOR cat IN filter_categories %]
<option value="[% cat | html %]"[% ' selected' IF filter_category.grep(cat).size %]>
[% cat | html %]
diff --git a/templates/web/fixmystreet.com/contact/unsuitable-text.html b/templates/web/fixmystreet.com/contact/unsuitable-text.html
new file mode 100644
index 000000000..92642aec7
--- /dev/null
+++ b/templates/web/fixmystreet.com/contact/unsuitable-text.html
@@ -0,0 +1,7 @@
+<p>
+ [% loc('Does this report break our <a href="/about/house-rules">House Rules</a>? Use this form to let us know.') %]
+</p>
+
+<p>
+ <strong>[% loc('If you are trying to make a new report, please <a href="/">go to the front page</a> and follow the instructions.') %]</strong>
+</p>
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index cd2a066e3..dd9167185 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -657,6 +657,19 @@ $.extend(fixmystreet.set_up, {
selector = "[data-category='" + category + "']";
$("form#report_inspect_form [data-category]:not(" + selector + ")").addClass("hidden");
$("form#report_inspect_form " + selector).removeClass("hidden");
+ // And update the associated priority list
+ var priorities = $("form#report_inspect_form " + selector).data('priorities');
+ var $select = $('#problem_priority'),
+ curr_pri = $select.val();
+ $select.find('option:gt(0)').remove();
+ $.each(priorities.split('&'), function(i, kv) {
+ if (!kv) {
+ return;
+ }
+ kv = kv.split('=', 2);
+ $select.append($('<option>', { value: kv[0], text: decodeURIComponent(kv[1]) }));
+ });
+ $select.val(curr_pri);
});
// The inspect form submit button can change depending on the selected state
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index f3753905b..7fb0c797f 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -289,7 +289,7 @@ select.form-control {
&[multiple] {
height: auto;
}
- .js &[multiple] {
+ .js &.js-multiple[multiple] {
height: 2.2em;
}
}