Commit Graph

8194 Commits

Author SHA1 Message Date
Chris Hill-Scott
913095fe60 Wrap a model around list of all organisations 2019-06-17 16:00:59 +01:00
Chris Hill-Scott
0aea038d51 Use new fields for getting orgs and services
Uses https://github.com/alphagov/notifications-api/pull/2539 to reduce
the number of API calls we make.
2019-06-17 15:56:59 +01:00
Chris Hill-Scott
da29d722f9 Merge pull request #2983 from alphagov/add-js-tests-for-fullscreen-table
Add js tests for fullscreen table
2019-06-17 10:00:53 +01:00
Chris Hill-Scott
cf3e9302a0 Merge pull request #3015 from alphagov/optional-platform-admin
add option to suppress platform admin temporarily
2019-06-17 10:00:45 +01:00
Chris Hill-Scott
faaa812379 Merge pull request #3013 from alphagov/org-client-refactor
Wrap get org methods in class method on model
2019-06-14 16:56:02 +01:00
Chris Hill-Scott
082349e68e Merge pull request #3014 from alphagov/cache-organisations
Cache organisations, not just domains in Redis
2019-06-14 16:55:53 +01:00
Chris Hill-Scott
08fe6865bd Merge pull request #2944 from alphagov/allow-replace-revoked-key
Allow replacing a revoked key
2019-06-14 16:55:45 +01:00
Leo Hemsted
d752a6335f make sure tests all populate the platform admin field
it's always returned by the API
2019-06-14 15:14:00 +01:00
Leo Hemsted
c724f84c23 change wording of platform admin toggle to positive rather than negative
CHS Approved Wording 👍

also rename suppress_platform_admin -> disable_platform_admin_view in
the backend, as suppress is a kinda weird word.
2019-06-14 15:13:56 +01:00
Leo Hemsted
7b02cb72c6 add option to suppress platform admin temporarily
so that platform admins (us) can view pages as regular users do easily.
Simply adds a flag in the session cookie that overrides the actual
platform admin flag on the user model if set. This way it's safe, since
this only downgrades existing functionality, so if someone managed to
alter it they could only get less permissions, not more.

You can change this value from the user profile page if either:

* you're a platform admin
* the flag is set (to any value) on the cookie.

This slightly weird check means that we don't check the underlying
`user._platform_admin` flag anywhere in the code, even when toggling
the suppression.
2019-06-14 11:59:12 +01:00
Chris Hill-Scott
8f9ade7a8b Cache organisations, not just domains in Redis
This should make the ‘All organisations’ page load a lil’ bit quicker.
Still worth caching the domains separately so the response is smaller
when we only care about domains. This is because the code that uses the
domains is part of the sign up flow, so it’s really important that it’s
snappy.
2019-06-14 11:20:19 +01:00
Chris Hill-Scott
c7325576d6 Merge pull request #3008 from alphagov/new-choose-service
Split choose service page into live services and trial mode services
2019-06-13 17:01:19 +01:00
Chris Hill-Scott
588e151d09 Merge pull request #3011 from alphagov/quis-patch-1
Remove debugging short circuit
2019-06-13 17:01:12 +01:00
Chris Hill-Scott
04f6bd8132 Wrap get org methods in class method on model
This means the service and user models have to import one fewer thing,
and matches what we’re doing with the `from_id` class method.
2019-06-13 14:23:02 +01:00
Chris Hill-Scott
edba0c7f5f Rename confusing property
It’s more about the multiple different types of things they can see, not
just that there are multiple things.
2019-06-13 13:47:29 +01:00
Chris Hill-Scott
53f5ebdd48 Add some visual differentiation for null info
We use light grey for stuff like ‘not set’ elsewhere. This knocks it
back a bit so the actual information on the page is more prominent.
2019-06-13 13:47:29 +01:00
Chris Hill-Scott
14a3420fbe Split list of user’s services into live and trial
This gives us as platform admin users a bit more context when we’re
looking at a user’s profile.
2019-06-13 13:47:29 +01:00
Chris Hill-Scott
451fadb1b3 Hide H1 for grid layout
With the `<h2>`s on this page it’s fairly explicit what the page is
listing, so user doesn’t need the context provided by the `<h1>`.
2019-06-13 13:47:29 +01:00
Chris Hill-Scott
8b6b8c6165 Add a grid layout to the choose services page
This allows us to split the page into sections without over-using bold
fonts. And it means that when the user clicks into a service from this
page the column layout stays the same 1/4 – 3/4, rather than jumping
about so much.
2019-06-13 13:47:28 +01:00
Chris Hill-Scott
e31570e93d Refactor to use .belongs_to methods
The view code shouldn’t need to know the internals of a service’s data
structure; the idea of having a service model is to abstract this kind
of thing.
2019-06-13 13:47:28 +01:00
Chris Hill-Scott
1b395c04f3 Go straight into org if no trial mode services
You might still belong to some services, but because they’re live
they’re all in your organisation.
2019-06-13 13:47:28 +01:00
Chris Hill-Scott
71dc650db6 Make user model return a service model, not JSON
This makes it:
- nicer, by having access to sensibly named things like
  `Service.trial_mode` instead of `service['restricted']`.
- less likely to write Jinja code like `service.trail_mode`, which would
  fail silently if `service` was a dictionary
2019-06-13 13:47:28 +01:00
Chris Hill-Scott
062f42b769 Rename all_services property on user
For consistency with `.organisations`/`.organisation_ids`.

`.services` returns a list of semi-rich dictionaries for each service.

`.service_ids` returns service IDs only.
2019-06-13 13:47:28 +01:00
Chris Hill-Scott
2f711b52ea Refactor choose service page into macros
This makes it easier to see the logic controlling which services are
shown where because the repetitive loops have been factored out.
2019-06-13 13:47:27 +01:00
Chris Hill-Scott
f774a10e3a Only show live services without an organisation
In reality we shouldn’t have any live services that don’t have an
organisation. But we probably do locally, in preview, etc., and we
shouldn’t lose a way of accessing them.
2019-06-13 13:47:27 +01:00
Chris Hill-Scott
3be1f79cf9 Add count of live services to organisations
This makes it clear that these are something different to the trial
mode services, in that they are a container of multiple things.
2019-06-13 13:42:11 +01:00
Chris Hill-Scott
722d1f0af4 Hide organisation services
We think users fall into three buckets:

Has access to a few live services, no organisations
--
In this case they user will just see the list of live services they have
access to – pretty straightforward.

Has access to all live services, plus the organisation
--
Conceptually the live services are part of the organisation, whereas the
trial mode ones aren’t. So it makes sense to go through the organisation
to see the live services. If we listed the live services on the choose
service page then we’d be confusingly duplicating them on the
organisation page.

Has access to the organisation, but no services
--
The user doesn’t have direct access to their organisation’s services, so
they need to go to via the organisation page to change service.

For both of the latter we’ll be providing a quick breadcrumb route back
into the organisation, so most of the time they won’t need to use the
choose service page at all.
2019-06-13 13:42:11 +01:00
Chris Hill-Scott
63ba3a6f30 Put organisations on the user model
As in other places, putting a model layer between the view and the API
client makes the code cleaner and clearer.
2019-06-13 13:42:11 +01:00
Chris Hill-Scott
88e36d6841 Move some methods from the API client to the model
They make more sense being on the model, and it doesn’t make any sense
to duplicate them.
2019-06-13 13:42:10 +01:00
Chris Hill-Scott
b233e3ca24 List live services if no organisations
If the user doesn’t belong to any organisations then the only live
services they can see are the ones they directly have access to. So
let’s list these above the user’s trial mode services (because they’re
more important).
2019-06-13 13:42:10 +01:00
Chris Hill-Scott
1ca0dfacf7 List all trial mode services
At the moment the service list doesn’t disambiguate between live and
trial mode services. This makes it hard to tell which of the things are
important and which aren’t.

The first step towards making this page clearer is to list trial mode
services separately.
2019-06-13 13:42:10 +01:00
Chris Hill-Scott
3511f8ad5b Move organisations out of platform admin area
It’s annoying having to go through the slow-to-load platform admin index
page to get to organisations. And it makes more sense for them to be
in the same place as other organisations and services that you can see.
2019-06-13 13:42:10 +01:00
Tom Byers
1a5d40312a Move window mock functions into helper class 2019-06-12 16:03:35 +01:00
Tom Byers
1082a37750 Update call out to sticky JS, with test for it 2019-06-12 16:03:26 +01:00
Tom Byers
0131f0c1b1 Move setup/teardown out of tests 2019-06-12 16:03:18 +01:00
Tom Byers
435334ba9c Add tests for full-screen table module 2019-06-12 16:03:09 +01:00
Chris Hill-Scott
2f4d9a1a46 Remove debugging short circuit
Circumventing this exception was only added for debugging purposes.
2019-06-12 13:33:58 +01:00
Chris Hill-Scott
cb63d44c08 Merge pull request #3009 from alphagov/no-back-link-just-sent
Hide back link when you’ve just sent a message
2019-06-11 13:31:04 +01:00
Chris Hill-Scott
c6b21ab022 Hide back link when you’ve just sent a message
Changed this yesterday. Changing it again now because I think it’s
confusing.

There’s really no going ‘back’ once you’ve sent a message – you can’t
undo it. If you want to get back to the template you used, well, that
link is in the page.

This commit changes the back link logic so it only appears when you’ve
navigated to a notification, not when you’ve just sent it.
2019-06-07 16:16:13 +01:00
Chris Hill-Scott
b93a72092b Merge pull request #3007 from alphagov/fix-invites
Fix inviting existing users
2019-06-06 17:40:42 +01:00
Chris Hill-Scott
6130004b0c Fix inviting existing users
The API needs the id of the user, not the id of the invite.

The problem with the tests is that the update mock returned a different
user ID than the user it was being passed. So the tests didn’t catch
this.
2019-06-06 17:24:48 +01:00
Chris Hill-Scott
f2303ff20a Merge pull request #3005 from alphagov/fix-back-links-tour
Fix back links in tour
2019-06-06 16:43:02 +01:00
Chris Hill-Scott
8034d7ecc2 Merge pull request #3006 from alphagov/fix-placeholder-collection-order-send-test
Fix order of steps in send/send test journeys
2019-06-06 16:42:42 +01:00
Katie Smith
486976a091 Merge pull request #2985 from alphagov/archive-user
Allow a user to be archived
2019-06-06 13:08:17 +01:00
Chris Hill-Scott
7cc8fcfb2d Fix order of steps in send/send test journeys
This fixes the bug where if you have three placeholders:
> ((one)) ((two)) ((three))

The first one you are asked to fill in is `((three))` (ie
`template.placeholders[-1]`).

This reintroduces a bug where if you use the ‘Use my phone number’ link
you skip straight to filling in `((two))` and can never proceed because
you’re never given the chance to fill in `((one))`. This commit also
fixes that bug.
2019-06-06 12:24:02 +01:00
Chris Hill-Scott
48eb698713 Fix back link on ‘sent’ page in tour
If the user wants to go back from here they need to be sent back to the
start of entering the placeholders, because we won’t have their previous
personalisation in the session still

I think the back link on this page was introduced by accident. But it’s
good to still have it on this page, because it keeps consistency with
the previous pages.
2019-06-06 12:00:23 +01:00
Katie Smith
a6f5abbf7e Only show archive user link for active users 2019-06-06 11:50:28 +01:00
Chris Hill-Scott
62fb71966b Add back links to all steps of tour 2019-06-06 11:31:50 +01:00
Katie Smith
f57f8641ad Add an event if a user is archived
This adds a new type of event, 'archive_user', which stores the id of
the archived user and the id of the user who is doing the archiving.
2019-06-06 09:56:16 +01:00
Katie Smith
73b4aa4d85 Refactor event handler code 2019-06-06 09:56:16 +01:00