Commit Graph

2954 Commits

Author SHA1 Message Date
Chris Hill-Scott
2bdd86c044 Remove logging of session size
There’s no record of this warning in our logs at the moment.
2021-01-13 13:11:58 +00:00
Chris Hill-Scott
287689c1b3 Merge pull request #3763 from alphagov/count-chars-sms-broadcast-templates
Add fragment or character counting when editing text message or broadcast templates
2021-01-08 16:38:03 +00:00
Chris Hill-Scott
638e505432 Stop content length message from making page jumpy
The content length message was making the page jumpy and causing reflows
in three ways. This commit addresses each of those ways:

As the user scrolled
---

The footer went from fixed to sticky and the spacing around the message
changed. This change in spacing was needed so that the message looked
right in both contexts.

I think the best way to resolve this is to not use the sticky footer
when editing text message or broadcast templates.

On my 1440×900 screen I can fit a 5 fragment text message, plus the
‘will be charged as 5 text messages’ message, plus the save button.

Our top 10 screen resolutions according to our analytics are:

Position | Resolution | Percentage of users
---------|------------|--------------------
 1       | 1920x1080  | 27.37%
 2       | 1280×720   | 11.07%
 3       | 1366×768   |  8.88%
 4       | 1536×864   |  5.79%
 5       | 1440×900   |  4.52%
 6       | 1600×900   |  3.71%
 7       | 1280×1024  |  3.10%
 8       | 1680×1050  |  2.42%
 9       | 1920×1200  |  2.33%
10       | 2560×1440  | 1.99%

When the page first loaded
---

The message is empty so takes up no space, then the javascript fires
and inserts the message, taking up a line of space.

This is resolved by making the empty message take up space with a
non-breaking space character.

When the user first typed
---

We previously didn’t show any message until the user started typing.
This meant that, with the above fix, there was a larger than normal
empty space between the textarea and the save button.

This is resolved by always showing the message, even when the user
hasn’t typed anything yet.

***

These are design decisions which made sense when the message was
displayed along side the button, but we’ve had to change now that the
message is above the button.
2021-01-08 15:39:21 +00:00
Chris Hill-Scott
64835cba86 Merge pull request #3475 from alphagov/request-invite
Allow invite form to be pre-populated with an existing user
2021-01-08 11:16:18 +00:00
Chris Hill-Scott
fbd58ef1f8 Add separate messages for invited/team member
2 messages seems like a good idea.
2021-01-08 10:56:59 +00:00
Chris Hill-Scott
48577b823e Add an endpoint to count the length of templates
Users sending text messages are sometimes unaware that long messages
will cost more.

Users sending broadcast messages need to be aware that there’s a
character limit, so they can take this into account when planning their
messages.

This commit adds an endpoint which counts the number of characters in
some template content, and returns a snippet of useful info about how
long the message is.

In subsequent commits we’ll be able to use AJAX to fetch this snippet as
the user types.

There’s a surprising amount of complexity in counting the length of
messages. So we’ll need to do this in Python because it would be too
convoluted to re-implement the length counting in client side code, let
alone ensuring it had parity with its Python equivalent.
2021-01-07 17:07:51 +00:00
Chris Hill-Scott
7a95e1618e Extract formatters into their own module
We have lots of functions for converting various types of data into
strings to be displayed to the user somewhere.

This commit collects all these functions into their own module, rather
than having them cluttering up `app/__init__.py` or buried amongst
various other things that have ended up in `app/utils.py`.
2021-01-07 11:57:30 +00:00
Chris Hill-Scott
2c46d023da Extract Spreadsheet model from app/utils.py
`app/utils.py` is a bit of a dumping ground for things we don’t have a
better place for.

We now have a place and structure for storing ‘model’ code (‘model’ in
the model, view, controller (MVC) sense of the word).

This commit moves the spreadsheet model to that place.
2021-01-06 12:31:39 +00:00
Chris Hill-Scott
a68dfae5c2 Short circuit if team member is already invited
It would be confusing if people got invited twice, so let’s tell people
if someone’s has a pending invite.
2020-12-31 14:50:13 +00:00
Chris Hill-Scott
92c6cca6a1 Don’t populate invite with users from other orgs
We shouldn’t have a page where someone can look up any other user’s
email address based on their user ID.

We also don’t want a page where a malicious user could send someone an
link which would get them invited to the service.

Restricting the invite to be populated just from users in their own
organisation doesn’t mitigate against this stuff completely, but they
probably have a way of finding out the email address of someone in their
organisation already.
2020-12-31 14:47:00 +00:00
Chris Hill-Scott
deaf2059f5 Short circuit if already a team member
It would be confusing if people got invited twice, so let’s tell people
if someone’s already been invited.
2020-12-31 14:45:58 +00:00
Chris Hill-Scott
6edc356c22 Allow invite form to be pre-populated
At the moment users must be invited to join a service. But this means:
- users must know that a service already exists
- they need to know who to ask for an invite

If the user doesn’t know these thing then sometimes they just go ahead
and set up a new service. Which means they have to get all the way to
the point of requesting to go live before we tell them that there’s
already a service with a similar name or purpose.

So we should let users:
1. discover what other services exist in their organisation
2. apply to join a service
3. automatically notify the service managers of their interest
4. be invited by a service manager
5. accept the invite

This commit implements step 4. We can just link them to the invite form
in step 3., but we should make it easy for them to send the invite,
without having to copy and paste email addresses.

So this commit let the invite form be pre-populated with an existing
user’s email address.
2020-12-31 14:35:39 +00:00
Chris Hill-Scott
8302b2b667 Validate length of broadcast content
Depends on:
- [ ] https://github.com/alphagov/notifications-utils/pull/826/files

Adds error messages for when the content of a broadcast template is too
long.

The error message is explicit when this is cause by non-GSM characters.
We may not want to expose this complexity to our users, but it’s useful
for now while we’re testing things out.
2020-12-29 11:29:57 +00:00
Chris Hill-Scott
c3515e44cd Stop accidental markdown in go live ticket
In Markdown this is interpreted as a H1:
```
Text
---
```

We can prevent this by adding an extra linebreak, like this:
```
Text

---
```
2020-12-22 17:03:22 +00:00
Chris Hill-Scott
d50eb11c7a Add email reply to address to go live ticket
It’s one of the things we check when someone makes a request to go live,
and putting it in the ticket means we don’t have to take the extra step
of clicking into the settings.

Also added some line breaks to chunk things up a bit more clearly.
2020-12-22 14:02:33 +00:00
Tom Byers
e80b02d2c9 Merge pull request #3742 from alphagov/fix-for-file-input-in-safari
Fix for file input bug in safari
2020-12-17 14:24:25 +00:00
Tom Byers
55a4ca6579 Remove set-to-string conversion from upload code
Also changes the allowed_spreadsheet_file_extensions
variable to allowed_file_extensions for
consistency.
2020-12-17 13:04:27 +00:00
Tom Byers
97bc2817bc Merge pull request #3731 from alphagov/add-govuk-radios-5
Add GOVUK radios [part 5]
2020-12-16 14:48:49 +00:00
Tom Byers
1096d1f707 Set accepted files for contact list upload 2020-12-16 14:48:10 +00:00
Tom Byers
fb1ac8bc42 Set accepted files for letter upload 2020-12-16 14:48:10 +00:00
Tom Byers
b8f8d743d5 Set accepted files for job spreadsheet upload 2020-12-16 14:48:10 +00:00
Tom Byers
d620d9ea08 Hide legend on SetEmailBranding.branding_style
Effects all routes that use that form, or
SetLetterBranding, which inherits from it:
- /organisations/<service_id>/settings/set-letter-branding
- /organisations/<service_id>/settings/set-email-branding
- /<service_id>/service-settings/set-letter-branding
- /<service_id>/service-settings/set-email-branding
2020-12-15 12:08:09 +00:00
Chris Hill-Scott
d1ab09db05 Merge pull request #3739 from alphagov/refactor-user-live-services
Remove separate function for live service check
2020-12-14 15:22:10 +00:00
Tom Byers
e8a74b7ed1 Convert radios on set email branding page
Changes SetEmailBranding.branding_style to
GovukRadiosFieldWithNoneOption.
2020-12-11 13:58:40 +00:00
Tom Byers
d911c1a707 Add GovukRadiosFieldWithNoneOption 2020-12-11 13:58:40 +00:00
Katie Smith
57189f57e4 Add form validation for max service and org name
There was a recent error in the logs because a service tried to change
its name to one exceeding 255 characters (which is a limit on the
database field). We can easily catch these errors on the form, so that
the user doesn't see an error page.
2020-12-11 11:33:34 +00:00
Chris Hill-Scott
5027be31fc Remove separate function for live service check
When we get a support ticket we need to check whether a user has any
live services.

We have a method for this on the user model now, so we don’t need a
separate function in the feedback code.

It wasn’t very well tested so I’ve adapted the old tests from the
feedback view to work against the method on the user model too.
2020-12-10 15:43:45 +00:00
Tom Byers
b1d0d216e0 Convert radios on add org page
Changes OrganisationCrownStatusForm.crown_status.

This also effects NewOrganisationForm, which
inherits from OrganisationCrownStatusForm.

Because of that this commit also updates the
template used for the edit org crown status page,
which uses NewOrganisationForm for its form.
2020-12-10 10:19:50 +00:00
Tom Byers
0cdbb850aa Convert radios in edit org type page (basic)
Changes the OrganisationTypeField class used by
OrganisationOrganisationTypeForm.organisation_type

OrganisationTypeField is also used by the forms in
/add-service:
- CreateServiceForm
- CreateNhsServiceForm

Because of that, this commit also includes changes
to the template for that route.

Note: this also moves where OrganisationTypeField
appears in app/main/forms.py so it can use
GovukRadiosField.
2020-12-10 10:19:49 +00:00
Tom Byers
58149ce34c Convert radios on SMS prefix page
Includes changing form.enabled to use
OnOffField, for consistency with other on/off
fields.

OnOffField's data is a boolean, not a string, so
some of the logic using it needed to be changed.
2020-12-09 15:03:43 +00:00
Tom Byers
b917fa3c74 Make OnOffField inherit from GovukRadiosField
Means that ServiceOnOffSettingForm.enabled ends up
using the GovukRadiosField methods for rendering.
2020-12-09 15:03:43 +00:00
Tom Byers
1fea95fae4 Convert radios on link-service-to-org page (basic) 2020-12-02 16:00:33 +00:00
Tom Byers
eac4b97cc3 Convert radios on user page (basic)
Covers the page for both new and existing users.
2020-12-02 16:00:32 +00:00
Tom Byers
8fa385220b Convert radios on uploads preview page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
ae59f602db Convert radios on edit postage page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
641f03cb5b Convert radios on support triage page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
ca50cf63cb Convert radios on /support page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
0f269a1259 Convert radios on set inbound page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
d0b8610cd8 Convert radios on research consent (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
25b89dd30a Convert radios on data retention page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
b1d65f33c7 Convert radios on clear cache page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
e979aef43f Convert radios on provider ratio page (basic)
Also changes the CSS for the radios slider variant
component.
2020-12-02 16:00:32 +00:00
Tom Byers
45526598c6 Convert radios on edit org agreement page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
6aaa4d906b Convert radios on add nhs local org page (basic) 2020-12-02 16:00:32 +00:00
Tom Byers
52929d835d Convert radios for P.Admin email branding (basic) 2020-12-02 16:00:32 +00:00
Chris Hill-Scott
b579f68411 Limit jobs sent from contact list by data retention
On the uploads page we only show jobs which are within a service’s data
retention.

This commit does the same for when we’re listing the jobs for a contact
list. This matches the UI, which says a contact list has been ‘used
`<count_of_jobs>` in the last <data_retention> days’
2020-12-01 13:57:56 +00:00
Chris Hill-Scott
423875011c Show jobs on contact list
It’s a bit unintuitive that starting a job from a contact list makes a
copy of the file, which has no relationship to the list it was copied
from. This is more of an implementation detail, rather than something
that comes from people’s mental models of what is going on. Or at least
that’s what I hypothesise.

I think it’s clearer to show jobs that come from contact lists within
the lists that they were created from. By naming the jobs by template
this gives a clearer view of what messages have been sent to the group
over time.
2020-11-30 13:54:54 +00:00
Tom Byers
2f5f836dda Correct 'thing' to users on manage folder page
The checkboxes component that lets you choose
which users have permission to see the folder is
currently using the noun of 'folder' in the
summary it generates.

This is because this page users the
TemplateFolderForm class, which defaults the
permissions to 'folder'.

This updates the field_label attribute, used by
the code that generates the summary, to 'user' to
match the type of permission.
2020-11-24 14:22:08 +00:00
Tom Byers
b0bab205da Plug GovukRadiosField into edit sms|email pages
Proof of concept for the GovukRadiosField class.

Includes the removal of the a DataRequired
validator. This doesn't seem to be needed as the
RadioField superclass catches any submissions
without any data from field.choices in its
pre_validate method (which also outputs the
correct error message).
2020-11-12 10:13:22 +00:00
Tom Byers
dd36137e3f Add GovukRadiosField
Roughly based on GovukCheckboxesField.
2020-11-12 10:13:20 +00:00