Commit Graph

3562 Commits

Author SHA1 Message Date
Chris Hill-Scott
89c63e3243 Remove custom getattr implementation from JSONModel
We wrote custom `__getattr__` and `__getitem__` implementation to make
it easier to find code that was accessing fields in the dictionary that
we weren’t aware of. See this commit for details:
b48305c50d

Now that no view-layer code accesses the service dictionary directly we
don’t need to support this behaviour any more. By removing it we can
make the model code simpler, and closer to the `SerialisedModel` it
inherits from.

It still needs some custom implementation because:
- a lot of our test fixtures are lazy and don’t set up all the expected
  fields, so we need to account for fields sometimes being present in
  the underlying dictionary and sometimes not
- we often implement a property that has the same name as one of the
  fields in the JSON, so we have to be careful not to try to override
  this property with the value from the underlying JSON
2020-10-19 15:52:51 +01:00
Chris Hill-Scott
274eff5f25 Merge pull request #3680 from alphagov/show-broadcast-content
Show preview of content for broadcast messages and templates
2020-10-19 14:22:41 +01:00
Chris Hill-Scott
43a27676cb Remove the styleguide
The idea was that this would be a place to document all the design
patterns used in Notify. However it hasn’t been kept up to date, and,
looking at the `git blame`[1] no new patterns have been added for 5
years.

I think it’s better to get rid of it than have to keep maintaining
something which is inaccurate.

1. 64aa0d359c/app/templates/views/styleguide.html
2020-10-16 10:14:23 +01:00
Chris Hill-Scott
e2f16e414d Style areas on dashboard the same as alert preview
Our style for areas is pale blue background with black keylines or bold
black text.

This commit makes the display of area names on the dashboard consistent
with that visual style.

This also means that we’re not truncating the list of areas, which is
appropriate because no one area is more important than any of the
others.
2020-10-14 13:22:00 +01:00
Chris Hill-Scott
5c9a886edc Preview content as hint for broadcast templates
Broadcast services only have broadcast templates. But we show the
template type under the name of the template. This is redundant. It
would be better to preview the content of the template instead.

This then makes the templates page consistent with the dashboard.

Depends on:
- [ ] https://github.com/alphagov/notifications-api/pull/2996
2020-10-14 13:21:19 +01:00
Chris Hill-Scott
8dae4f771a Show the content of the alert on the dashboard
The content is as important as which areas you’ve sent the broadcast to.
2020-10-14 13:21:19 +01:00
Chris Hill-Scott
0cd08a94ff Rename dashboard to ‘current alerts’
The dashboard for normal services is quite general, because it tells
you a bit about channels, templates and spend.

What is now the dashboard for broadcast services is much more specific,
therefore less like a dashboard. We can reflect this by giving it a more
specific name. This should reduce the amount of navigation surfing
people need to do in order to find the thing they’re looking for.
2020-10-13 14:47:27 +01:00
Chris Hill-Scott
698f98389c Remove previous broadcasts from the dashboard
Since they have their own page now they don’t need to also appear on the
dashboard.
2020-10-13 14:47:10 +01:00
Chris Hill-Scott
f0220fa9fb Make a separate page for previous alerts
Previous alerts are much less important than ones that are live or
waiting for approval.

Therefore we can make the dashboard more focused by moving previous
alerts to their own page.
2020-10-13 14:45:08 +01:00
Chris Hill-Scott
8ff9ec6d97 Replace generated content with proper heading
Brings in https://github.com/alphagov/notifications-utils/pull/797 but
adapts the CSS so nothing changes visually
2020-10-12 15:55:30 +01:00
Chris Hill-Scott
3f338d45ca Rename CSS classes for consistency
This prefixes everything to do with areas/the map with `area-list`, so
from looking at one element you know which `.scss` file will contain the
relevant code.
2020-10-12 15:53:09 +01:00
Chris Hill-Scott
3eb97f76b8 Merge pull request #3676 from alphagov/broadcast-includes-content
Add content property to broadcast message model
2020-10-12 15:29:48 +01:00
David McDonald
895b6bcc9e Merge pull request #3674 from alphagov/remove-test-routes
Remove `test/step-` routes
2020-10-12 14:25:31 +01:00
Chris Hill-Scott
974fb8c6c1 Accept content as keyword argument 2020-10-12 14:18:33 +01:00
Chris Hill-Scott
d8b265b0ca Add comments to make test data clearer
It’s not clear where 103 is coming from unless you know that the code is
doing the slightly unintuitive thing of displaying the max of all return
values.
2020-10-12 14:14:12 +01:00
Pea M. Tyczynska
b60d25da67 Merge pull request #3670 from alphagov/show-broadcast-tour-when-password-reset
Take user to page they are meant to visit in various sign-in flow scenarios
2020-10-12 12:27:37 +01:00
Pea Tyczynska
6578719103 Test next redirects with realistic URL
This change has been made following PR review, to ensure
that special signs are transformed correctly when passing
through the next URL.
2020-10-12 12:01:39 +01:00
David McDonald
7d3a4e6085 Remove test/step- routes
We don't need these anymore as all users will use the `one-off/step`
routes.

This has mostly involved tidying up the tests which are still a little
disorganised and not as good as I'd like but it's a step in the right
direction.

More refactoring is still possible to the routes, it may come in a later
PR if I have time.
2020-10-09 17:36:09 +01:00
David McDonald
99880fd672 Merge pull request #3668 from alphagov/use-one-off-route
When sending to yourself use 'one-off' rather than 'test' routes
2020-10-09 16:02:01 +01:00
Chris Hill-Scott
54d4fb2a6c Allow platform admins to clear cached broadcasts
When we add a new property to the broadcast model, we need to delete any
cached broadcasts from Redis that are missing the new property. So this
adds an option to do this to the cache page in platform admin.

I’ve also tried to make it more obvious what the magic numbers in the
test fixture are doing.
2020-10-09 15:41:48 +01:00
Chris Hill-Scott
850571cb8c Recognise that broadcast messages include content
The content attribute needs to be added to the model so we can use it
later.
2020-10-09 15:41:38 +01:00
Tom Byers
e848db0d04 Merge pull request #3673 from alphagov/remove-page-title-hack-from-autofocus
Don't prefix with the page title when focusing on load
2020-10-09 13:42:26 +01:00
Pea Tyczynska
2203fae195 Turn on redirects revalidate_email_sent
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:23 +01:00
Pea Tyczynska
44ddee23ac Turn on redirects two_factor
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:23 +01:00
Pea Tyczynska
a531c888ba Turn on redirects two_factor_email
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:22 +01:00
Pea Tyczynska
5dd010ece8 Turn on redirects for two_factor_email_sent
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:22 +01:00
Pea Tyczynska
a6543c6e57 Turn on redirects for sign_in
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:22 +01:00
Pea Tyczynska
1fc2bee42d Turn on redirects for new_password
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 12:39:21 +01:00
Pea Tyczynska
b0db60e417 Turn on redirects for email_not_received
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 11:52:19 +01:00
Pea Tyczynska
1dd8b08042 Turn on redirects for check_and_resend_verification_code
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 11:51:15 +01:00
Pea Tyczynska
c3b7481e11 Turn on redirects for check_and_resend_text_code
This is part of the work to make sure user is redirected
to the page they initially were meant to visit after
they sign in.
2020-10-09 11:49:48 +01:00
Chris Hill-Scott
0f5c0a251c Merge pull request #3672 from alphagov/no-personalisation-broadcast
Don’t allow or highlight personalisation in broadcast templates
2020-10-08 15:45:51 +01:00
Tom Byers
fafe58a79b Merge pull request #3664 from alphagov/fix-template-controls-for-screenreaders
Fix template controls for screenreaders
2020-10-06 14:02:27 +01:00
Chris Hill-Scott
fad63117d6 Merge pull request #3658 from alphagov/use-scheduled-job-stats
Use new API endpoint for scheduled job stats
2020-10-06 12:00:38 +01:00
Chris Hill-Scott
54a5306399 Merge pull request #3660 from alphagov/fix-incorrect-processing-started-time-jobs
Fix incorrect processing started time on jobs
2020-10-06 12:00:30 +01:00
Tom Byers
90504d9b6c Don't prefix with the page title on focus
Doing this was helpful to Voiceover users as its
announcement of the label meant the page title
(normally announced onload) wasn't skipped.

This isn't the case with JAWS so, prefixing the
title makes it announce it twice.

JAWS has a lot more users and the title being
announced twice is more confusing than not at all
so this removes it.
2020-10-06 11:58:59 +01:00
Chris Hill-Scott
eb58851e93 Explicitly test that stats endpoint isn’t called
If we know a service has no jobs, we shouldn’t check to see if it has
scheduled jobs.
2020-10-06 11:53:00 +01:00
Chris Hill-Scott
9c5dceaf81 Ensure test data uses timezone aware timestamps
This reflects what the API sends us, and means we have to do less
timezone-wrangling.
2020-10-06 11:34:08 +01:00
Leo Hemsted
8ec9fe96a9 Delete new format template cache when moving folders 2020-10-06 09:47:22 +01:00
Chris Hill-Scott
207ea91acd Don’t highlight ((double brackets)) in broadcast templates
You can’t use them to personalise the message, so it’s confusing for
the UI to suggest they’re somehow special.
2020-10-05 17:22:06 +01:00
Chris Hill-Scott
c8e85efd54 Don’t allow personalisation in broadcast templates
Since we don’t have a way of filling in the personalisation at the
moment we shouldn’t allow people to make templates that require it.
2020-10-05 17:17:21 +01:00
Pea Tyczynska
d089424501 Forgot password sends redirect link
with reset password email.

This is so when users reset their password they are still
redirected to pages they were meant to visit.

This change was done specifically so everyone who is meant to see
broadcast tour sees it, but it will improve lives of all users
who wanted to visit a page on Notify but then had to reset
their password in the process.
2020-10-05 16:58:43 +01:00
Leo Hemsted
6eccc66115 delete template keys properly from platform admin page 2020-10-05 16:52:48 +01:00
David McDonald
4aaf47aaa1 When sending to yourself use 'one-off' rather than 'test' routes
There is no real reason to have to support both 'one-off' steps and also
'test' steps when sending a one off notification. It's a lot of complex
code, just to now set the one of the placeholders in the session.

We make our code much simpler but no longer using the 'test' routes but
instead adding a new endpoint to set the notification recipient when
sending to yourself before continuing on with the rest of the 'one-off'
flow.

After this is deployed for a day then we can completely remove the
'test' routes and this will help remove a lot of code complexity.
2020-10-05 16:20:04 +01:00
Pea Tyczynska
ab10009e4d Redirect link included in links for password reset
on sign-in page.
2020-10-05 15:38:34 +01:00
David McDonald
389638244c Remove old tour and help arguments from sending flow
We no longer need the `start_tour` page as this has been replaced with
the new `begin_tour` page.

We also no longer need to handle the `help` argument in the
`send_test_step` or `send_one_off_step` as these no longer are
responsible for the tour and don't need to show the help text.

Worth pointing out, the new tour joins into the send one off flow. When
doing a GET `check_tour_notification`, and submitting the form shown on
this page you are POSTed to `send_notification` with `help=3`. Also for
general sending of one off notifications, the POST to
`send_notification` is done with `help=0` which is a bit of a hack to
make sure that we don't show a back link on the `view_notification` page
for when someone gets there having just sent a one off notification.
This use of `help=0` may be a candidate for a refactor in the future as
it feels like a bit of a hacky way of doing things and is therefore not
as clear to developers what is going on.

Also removes the help argument from the csv routes used here. There is
no reason that we need to ever show help for CSVs and this is leftover
code from when we used to do the tour that way.
2020-10-05 12:44:19 +01:00
David McDonald
1b310a0f8a Merge pull request #3663 from alphagov/separate-tour
Move intro to Notify tour into separate views to reduce code complexity
2020-10-05 09:53:33 +01:00
David McDonald
7b82ca5083 Remove deleting of old redis key
At this point we are no longer setting this key, nor are we reading from
it so we are able to delete it.
2020-10-02 15:21:30 +01:00
Tom Byers
87dcea779e Make footer popup forms groups & add labelling
The existing behaviour focused the form control
for each popup (radios or textbox) when opened.

This gives no indication the submit button or
cancel link have been added to the page.

These changes:
- make the parent element a region to group all
  the new content
- label the region to link it to the button that
  opened it
- add a description to the region so users know
  how to use it and that all the controls have
  been added to the page
2020-10-02 15:08:09 +01:00
David McDonald
c1f67514a2 404 for step-0 2020-10-02 14:44:17 +01:00