Commit Graph

36 Commits

Author SHA1 Message Date
Chris Hill-Scott
184a9fa605 Use email fields for feedback form
Otherwise we can end up collecting invalid email addresses…

This required some refactoring to allow our email fields to be optional
(but not by default).
2018-12-07 13:11:41 +00:00
Leo Hemsted
ad8e95302c fix pete's broken tests 2018-06-15 16:27:17 +01:00
Chris Hill-Scott
dc6d66daba Make people sign in to get the agreement
Currently we have a bunch of users who aren’t signed in asking us for
the agreement.

This is bad because:
- it’s slower (for them) than just being able to download it
- it creates work for us

We can’t just offer the agreement to anyone, but we can offer to it to
anyone who’s signed in because we now let people self-select which
version to download when we can’t tell which one to give them.
2018-05-09 13:41:51 +01:00
Leo Hemsted
023c4121b3 separate urgent and p1 concepts in feedback.
p1 == "should notify team be alerted of this (via pagerduty)"
urgent == "should the user be told we'll look at it"

* If it's in office hours, it's always urgent. It's never a P1 because
  we'll notice it anyway
* If it's outside of office hours, it's urgent and P1 if it's severe,
  otherwise it's neither
2018-04-27 14:20:15 +01:00
Leo Hemsted
198bc476bb remove old feedback urls
not been hit in the last couple of weeks
2018-04-25 13:43:15 +01:00
Leo Hemsted
d675ceb5c2 send zendesk rather than deskpro tickets 2018-04-24 17:37:15 +01:00
Chris Hill-Scott
64b5f03dcd Don’t populate support form with arbitrary text
I don’t think it’s a massive risk (we’re certainly mitigating against
any XSS), but having a page on a GOV.UK domain where you can prefill
text on the page from a query string probably isn’t great.

So this commit restricts prefilling the support form to a set of
named questions.
2018-03-20 16:07:23 +00:00
Chris Hill-Scott
1ce4c874ad Allow message to be prefilled on feedback page
So that people don’t have to remember what they are supposed to be
asking for and go to the effort of typing out the message.
2018-03-14 16:02:09 +00:00
Chris Hill-Scott
f3a0c505bd Enforce order and style of imports
Done using isort[1], with the following command:
```
isort -rc ./app ./tests
```

Adds linting to the `run_tests.sh` script to stop badly-sorted imports
getting re-introduced.

Chosen style is ‘Vertical Hanging Indent’ with trailing commas, because
I think it gives the cleanest diffs, eg:
```
from third_party import (
    lib1,
    lib2,
    lib3,
    lib4,
)
```

1. https://pypi.python.org/pypi/isort
2018-02-27 16:35:13 +00:00
Alexey Bezhan
a23efc9a93 Replace Deskpro ad-hoc requests with a client from utils
Moves the duplicated calls to Deskpro to notification_utils and
rewrites feedback and service go-live requests to use the shared
client.
2018-01-17 14:31:27 +00:00
chrisw
90e18e04ee Updated support views to represent new url structure 2017-11-29 13:58:12 +00:00
chrisw
6b98e62f4c Updated support logic to represent new urls structure 2017-11-28 11:59:11 +00:00
Chris Hill-Scott
109b41a430 Fix broken link in support process
The idea is if you decide your problem isn’t such an emergency after
all, we direct you to the form where you can report it as such. This
link wasn’t working because it didn’t understand `False` to mean ‘not
severe’. Only ‘no’ means not severe.

The result was that users got sent in a bit of a convoluted loop
where they were asked again if their problem was an emergency or not.

Testing this by making sure that both:
- the URL in the link is what we expected
- when visited it gives the page title we expect

Because even if we had had the first test only, it wouldn’t have caught
this bug.
2017-07-15 07:23:22 +01:00
Chris Hill-Scott
4259fb02ba Add handler for old feedback form
Cool URIs don’t change 😎

https://www.w3.org/Provider/Style/URI

We still have links to `/feedback` in our emails. These will live in people’s inboxes forever.
2017-06-07 12:25:33 +01:00
Chris Hill-Scott
56a282f2a0 Fix infinite loop in support flow
The support flow was using `yes` and `no` to mean emergency/not
emergency. But not in all places – in one place it was using
`True`/`False` instead.

We were treating anything other than `yes`/`no` as a non-answer, which
means ask the question again. Because of the `True`/`False` thing, there
was no way of the user providing a valid `yes`/`no` answer. Which means
that we just kept asking them the question again and again and they got
stuck in a loop.
2017-03-07 09:44:21 +00:00
Imdad Ahad
24b372de77 Update go-live message + tests 2017-02-07 16:14:58 +00:00
Pete Herlihy
93fb6655fa Added user name to feedback subject line in tests 2017-02-07 16:03:40 +00:00
Chris Hill-Scott
5fa115a8bd Fix intermittent test failure on query ordering
(I suspect that) because Python dictionaries are not ordered, you can’t
rely on the order of query parameters in a URL to match the arguments
passed to `url_for`. This means the tests can intermittently fail.

This does some hacky workaround stuff to still have reasonable test, but
one that will pass whatever the order of the query parameters is.
2017-02-02 15:31:03 +00:00
Chris Hill-Scott
ef1bbb5692 Be stricter about meaning of severe query param
`severe` can mean one of three things:
- `yes` – user has told us this is an emergency
- `no` – user has told us this isn’t an emergency
- Anything else – user hasn’t been asked the question or has
  hacked/mangled the URL

This commit adds some stricter sanitisation of the `severe` query
parameter and does so up front, rather than spreading it across multiple
functions.
2017-02-02 15:18:42 +00:00
Chris Hill-Scott
f3e52d310b Make calculation of business hours timezone aware
`replace` doesn’t convert a time from one timezone to another. It just
changes the label that says what timezone a time is in 😬

`.localize` is how we handle these kind of issues in the API (see
d0b467b2fb/app/utils.py (L42-L44) )

So this commit changes the calculation to use `.localize`, and makes the
tests timezone aware to check we’re doing this right.
2017-02-02 15:18:42 +00:00
Chris Hill-Scott
b39222a62e Removed duplicate test 2017-02-02 15:18:42 +00:00
Chris Hill-Scott
17a4d8ef3b Use boolean logic instead of any/all
Using and/or over any/all has a couple of advantages:

- it's a bit quicker
- it won't evaluate the second half at all if the first half fails – if
  it is in business hours, and convert_to_boolean would raise, with your
  use of all we'd throw a 500, whereas if we had or, business_hours
  would trip and we'd skip over the second half without worrying about
  exceptions

any and all are designed for use with variable length args eg
`any(x for x in thing())`
2017-02-02 15:18:42 +00:00
Leo Hemsted
199dc24cb8 display service name in feedback email if user is logged in
also, split out a couple of tests for legibility and clear up some
linter errors
2017-02-02 15:18:41 +00:00
Chris Hill-Scott
d2680fe885 Require email address for reporting problems
If you report a problem we want to be able to get back to you to find
out more information, or to update you on the status of a fix. So it
shouldn’t be possible to report a problem without providing an email
address.

This commit makes `email_address` a required field when `ticket_type` is
problem.

This requires a bit of fiddling with the tests which weren’t expecting
to have to provide an email address. So the tests now either:
- pass an email address
- check for an error when they don’t pass an email address
2017-02-02 15:18:41 +00:00
Chris Hill-Scott
5f47ebb8e0 Remove redundant test
This looks like I accidentally copy pasted this (along with some stuff
that was meant to come over) as part of 22fe164711
2017-02-02 15:18:41 +00:00
Chris Hill-Scott
8f3ba46b27 Preserve message in session if we go out of hours
This is a real edge case, but it seems worth handling.

How you’d get to this case:
- it’s 5:29pm and you start to describe the problem you’re having
- it’s 5:31pm and you click ‘submit’
- you’re redirected to the triage page because we’re now out of hours
- you click ‘this is a serious problem’

What would be bad thing to happen:
- you’re back on the message page and all the stuff you’ve written is
  gone

What would be a good thing to happen:
- we save the message in a session so that you can check it again before
  sending it
2017-02-02 15:18:41 +00:00
Chris Hill-Scott
4ef087fb01 Add a confirmation page
Generally I prefer confirmation pages to the flash message thing
(they’re harder to miss). So this commit adds one.

It also adds some logic to this page, so that, depending what the user
has told us about the thing they’ve submitted, we can tell them how
quickly to expect a response.
2017-02-02 15:18:41 +00:00
Chris Hill-Scott
438868257f Triage tickets based on time of day and services
TL;DR, as much as possible we should work out how to prioritise tickets
and not put that burden on the user. However, there are some cases where
we can’t.

In business hours all tickets are high priority, ie we will at least
acknowledge them within 30 mins.

If we are not in business hours then we need to know if a ticket is
serious enough to get someone out of bed. Only the user can tell us
this, but we can give them some examples to help them decide.

In addition, out-of-hours tickets are only a priority if the user has
live services. Normally we can determine this and do the
priority-setting in the background.

If they can’t log in then we can’t determine what services they have. So
in this case they will need to use the emergency email address, which
only users with live services will have.

The logic for this gets fairly complex. It might be to easier to
understand what’s going on by walking through the test cases, which are
a bit more declarative.

N.B. Deskpro’s ‘urgency’ is descending, eg 10 is the most urgent and 1
is the least.
2017-02-02 15:18:40 +00:00
Chris Hill-Scott
8d7869ee54 Don’t ask for a user’s email address if we know it
If a user is logged in then we already know their name and email
address. So there’s no need for them to fill them again on the support
form.

One concern we might have about this is the user not realising we’re
doing this, and the feedback form looking like a bit of a black hole.
So we’re replaying their email address on this page to reassure them
that:
- we know who they are
- and that they’ll get a reply
2017-02-02 15:18:40 +00:00
Chris Hill-Scott
1df3c11ae9 Split support into two pages
The kind of communications we’re getting at the moment can broadly be
broken down into:
- problems
- questions and feedback

We will need to triage problems differently, because they could
potentially be urgent/severe/emergency/P1/whatever language we use.
Questions or feedback will never be P1.

Two reasons for making the user categorise their tickets themselves:

- Outside of hours we can’t get someone out of bed in order to decide if
  a ticket is a problem or just feedback

- We can tailor the subsequent pages to whether it’s a problem or
  feedback (eg showing a link to the status page if the user is having
  a problem)

This commit let’s users make the choice with a pair of radio buttons.

It also cleans up a bunch of the tests and parameterizes them so we’re
testing the flow for both ticket types.
2017-02-02 15:18:40 +00:00
Chris Hill-Scott
4503724ad6 Add a support index page
Our support process is about to get more fully fledged so we’ll need
an index page to route people properly.

We reckon that users will also want to know what the support process is,
so let’s explain it on this page.
2017-02-02 15:18:39 +00:00
Leo Hemsted
d5238bce5b handle if user doesn't provide name/email
also clean up usage of DESKPRO_PERSON_EMAIL and put it in the conf rather than env
2016-08-04 18:01:08 +01:00
Chris Hill-Scott
228abf4526 Use correct key to set team in DeskPro
For the `POST` ticket endpoint, the parameter is `agent_team_id`:

https://manuals.deskpro.com/html/developer-apps/api/api-tickets.html#id2
2016-05-20 15:58:20 +01:00
Adam Shimali
e181940966 Renamed DESKPRO_TEAM_ID to DESKPRO_DEPT_ID to match name of param in
api call.

Added DESKPRO_ASSIGNED_AGENT_TEAM_ID so that tickets routed correctly.
2016-05-18 15:03:23 +01:00
Chris Hill-Scott
a65466327c Put environment URL in feedback tickets
So that:
- we know what environment a request has been sent from
2016-04-26 16:46:00 +01:00
Chris Hill-Scott
22fe164711 Move feedback endpoints into own file
Doesn’t make sense to shove more stuff into index.py
2016-04-26 14:45:31 +01:00