Commit Graph

311 Commits

Author SHA1 Message Date
chrisw
e149d0eb91 Allow one-off email sending to select the reply-to address 2017-10-17 11:15:26 +01:00
chrisw
a94415632d Add multiple letter contact blocks for services from Admin app 2017-10-12 09:47:58 +01:00
Chris Hill-Scott
9c25b2d2da Add note about letters
When trying to send letters using the API, the ‘team and whitelist’ key
is confusing. We don’t have addresses for your team members, nor is
there a whitelist for letter addresses. The actual behaviour is that
you’ll get an error if you try to use this key to send letters.

So, for services who have letters available, we should add a hint
telling users that team and whitelist is probably not the key they’re
looking for.
2017-10-03 13:29:12 +01:00
chrisw
43395bc9d9 Added letters info to service / admin dashboard & activity page 2017-10-03 10:28:34 +01:00
Leo Hemsted
57b4971ac1 update conftest and tests to contain accurate test data
specifically, we identify inbound vs outbound by presence of
"notify_number", so ensure that test content actually contains that
field
2017-09-29 10:15:17 +01:00
Chris Hill-Scott
3906b31929 Optionally let client_request test for redirect
A common pattern we employ is `POST`-redirect-`GET`. To write tests for
this we often check that the URL of the redirect is what we’re
expecting.

With the way `client_request` is currently set up, there’s no way to do
this because the response isn’t exposed to the test.

So this commit adds an extra parameter which will let us test for
redirects.
2017-09-26 14:07:01 +01:00
chrisw
f012ec57c0 Allow user to add multiple reply-to addresses 2017-09-25 17:05:41 +01:00
Rebecca Law
16f3aafa10 Removed service_api_client.get_monthly_notification_stats because it is not being used anymore. 2017-08-23 17:07:42 +01:00
Chris Hill-Scott
dd5d6e4d59 Merge pull request #1435 from alphagov/manage-templates-permission
Separate ‘manage service’ and ‘manage templates’ permissions
2017-08-22 12:30:57 +01:00
Rebecca Law
0f6fcb8d0b formatting 2017-08-21 14:04:40 +01:00
Rebecca Law
8cf29a7d04 Merge branch 'master' into inbound_number_admin 2017-08-21 13:50:49 +01:00
Rebecca Law
6b04373bcf Remove unused template.
Revert formatting changes
2017-08-21 13:47:24 +01:00
Chris Hill-Scott
d591b9aeb9 Add a fourth, ‘manage templates’ permission
We’ve seen from research (a long time ago) that the ‘manage service’
permission is too broad, and gives too much control to someone who only
needs the ability to edit templates. In other words, editing content
should be its own, separate permission, rather than being rolled up
into manage service.

Since this is already disaggregated on the API side, making this change
just means changing the mapping on the admin side and adding an extra
checkbox on the invite/edit page. Which is what this commit does.

So for now, an existing user who has the manage service permission gets
both manage service and manage templates (ie no change to what they can
do). Newly invited users will get to choose if they have both, either,
or neither.
2017-08-17 17:47:30 +01:00
Imdad Ahad
fa99af6598 Merge pull request #1432 from alphagov/imdad-feat-make-usage-use-new-endpoints
Update the usage page to use new billing endpoints
2017-08-17 15:37:26 +01:00
Imdad Ahad
32242c4501 Update the usage page to use new billing endpoints
* Create new billing_api_client for separation and remove
older methods in the service_api_client
2017-08-16 16:31:47 +01:00
venusbb
87e987b148 merge master 2017-08-11 09:36:05 +01:00
venusbb
981aa1aaea some test codes 2017-08-10 17:08:01 +01:00
Rebecca Law
9b9c6d75dc - Change update service name to check that the name/email_from is unique across all services.
- This is done using a new endpoint in the api.
- Removed the AddServiceForm in favor or using the ServiceNameForm
- Removed ServiceApiClient.find_all_service_email_from
2017-08-09 16:52:10 +01:00
Rebecca Law
186202cc9d [WIP]
Let the API return a 400 error message if the service name is a duplicate.
2017-08-07 11:30:25 +01:00
Imdad Ahad
5a81064f07 Update message for last used template on delete:
* API now returns an empty response if a template was last used more than seven
* days ago
* Handle the empty response appropriately
2017-08-01 13:51:27 +01:00
Chris Hill-Scott
26b333512c Add separate pages to view live/trial services
We have a lot of services now. Mostly we want to look at what live
services are doing. So loading up the trial mode services every time
slows things – generating, rendering and using the page – right down.

This commit adds two new pages, one to view only live services, and one
to view trial mode services.
2017-07-26 07:56:19 +01:00
Chris Hill-Scott
32ae0a9b36 Merge pull request #1364 from alphagov/letter-job-page-real
Customise the job page to make sense for letters
2017-07-21 13:10:09 +01:00
Chris Hill-Scott
68078041dd Show personalisation in individual letters
Adds a new endpoint that works like view template/view preview of
letter, so that this page works the same way it does for emails/text
messages (ie showing the full content of the message, including
personalisation).

We’re not worrying about redaction in letters for now.
2017-07-19 19:01:39 +01:00
Chris Hill-Scott
63e9ef44e7 Don’t show status for individual letters
The status won’t ever change from sending for letters. For now at least.
And even when we do come up with more useful statuses I’m not convinced
it’s useful to expose them to our admin users.

A more useful piece of information to show is when we think the letter
will be delivered.
2017-07-19 19:01:39 +01:00
Chris Hill-Scott
a282850a0c Allow get template fixture to accept version
The other template fixtures do, because the real API call does, it was
omitted from the letter equivalent.
2017-07-18 10:37:54 +01:00
Chris Hill-Scott
dca0fce1e4 Merge pull request #1361 from alphagov/fix-permissions-inbox
Fix wrong permissions on dashboard pages
2017-07-12 16:07:13 +01:00
Chris Hill-Scott
037970c48c Fix wrong permissions on dashboard pages
Anyone with access to a service should be able to see:
- monthly breakdown (non financial)
- incoming messages

Adds tests to check the same.
2017-07-12 09:07:14 +01:00
kentsanggds
18e7f3eccb Merge pull request #1346 from alphagov/allow-email-and-sms-to-be-disabled
Allow email and sms to be disabled
2017-07-10 12:43:17 +01:00
Katie Smith
42a8474415 Stop users from editing/adding templates without the correct permission
If sending SMS is disabled for a service, it should not be possible to
add or modify SMS templates. If a user tries to do this, they should see
a different page with a link to go back. The same thing should happen
with email templates.
2017-07-05 09:15:32 +01:00
Chris Hill Scott
17199f0c26 Test for page titles in client request fixture
We’re frequently ending up with mismatched page titles on our pages
because:
- they’re hard to spot in the browsers tab bar
- new pages are often created by copy pasting old ones

It would be hard to write some kind of macro that spat out the h1
and the page title because they go into different blocks in the
parent template.

Instead, we can catch these mistakes by testing for them. Going
forward we should be using the `client_request` fixture for testing.
So it makes sense to put the page title test in here so that we
get it for free in every test – same way we do for testing response
codes.

fixup! Test for page titles in client request fixture
2017-07-05 09:01:46 +01:00
Chris Hill Scott
ecc506306b Move helper function
`test_utils.py` is actually a file for testing some utils, not
some utils for testing.

Test helper functions and fixtures are better placed in conftest,
and also means that we can use them in conftest.
2017-07-04 14:17:36 +01:00
Chris Hill Scott
8eed32620d Fix link to dashboard from end of tour
The notification page was different to the job page in that it
passed through the whole template, not just the ID.
2017-07-03 15:29:11 +01:00
Chris Hill-Scott
bc880017e5 Respect template’s redaction preference
If a template has the `redact_personalisation` flag set, then this
commit removes the personalisation from the notification before
rehydrating the template.

We’re doing this because we have a need to not show things like one time
passwords or two factor codes when we show the content of messages.

By passing through empty personalisation, and the `redact_missing` flag,
the `Template` instance will make use of the work done in:
- [x] https://github.com/alphagov/notifications-utils/pull/171
2017-06-30 14:04:11 +01:00
Chris Hill-Scott
9f20ea4b7e Revert "Merge pull request #1336 from alphagov/revert-show-notifications"
This reverts commit 7e354ff341, reversing
changes made to 6f3bcff32f.
2017-06-30 14:01:18 +01:00
Leo Hemsted
a31bf0c5ce add tests for new check and send notification endpoints 2017-06-29 12:40:03 +01:00
Chris Hill-Scott
6e48dc7689 Add a message saying a template has been redacted
This is useful if it’s been redacted by someone who isn’t you.
2017-06-28 15:27:09 +01:00
Chris Hill-Scott
9569521142 Add feature to mark a template as redacted
Works similarly to the delete template flow, because it’s a destructive,
one-way action.

Not on the edit template page, because it’s not something you want to be
considering every time you’re editing a template. And we saw that people
couldn’t find the delete button when it was on this page.

Adds a bit more CSS for the `dangerous` banner type, because the content
here is quite complicated. Breaking it into a list helps, but the
spacing didn’t look right, so needed some tweaking.

Can ship independently of the code that shows the redaction, but needs
the API first.
2017-06-28 15:27:07 +01:00
Chris Hill-Scott
1dbd6a122d Make client_request understand POST-redirect-GET
When we do a `POST` we almost always do a redirect straight afterwards.
`client_request` understands this, and expects a `302` by default.

However, if the `_follow_redirects` flag is set the status code returned
is that of the subsequent request – normally a `GET`, itself returning
`200`. Therefore the default expected response code would need to be
overridden.

Overriding this repeatedly would get pretty boring. Better to do it once
inside the fixture.
2017-06-28 15:27:06 +01:00
kentsanggds
8202c44202 Merge pull request #1335 from alphagov/ken-use-new-service-permissions
Use new service permissions
2017-06-27 11:27:12 +01:00
Chris Hill-Scott
b450a349a3 Revert "Merge pull request #1328 from alphagov/notification-page-reworked"
This reverts commit 1797162248, reversing
changes made to 95b4d9eb31.
2017-06-23 15:56:25 +01:00
Chris Hill-Scott
5c0f6796e4 Revert "Merge pull request #1333 from alphagov/fix-empty-table-message"
This reverts commit 114bac7b80, reversing
changes made to 69445380d9.
2017-06-23 15:55:54 +01:00
Ken Tsang
bcc45ede9c Refactored code for new service permissions 2017-06-23 14:27:41 +01:00
Chris Hill-Scott
f386b991cb Only show template navigation when it’s useful
There are lots of services that only send emails, or only send text
messages. For these services, being able to filter the list of templates
but type is pointless – it won’t cut the list down at all.

This commit adds some logic to only show the navigation if the service
has some variety of template types.
2017-06-23 13:49:26 +01:00
Chris Hill-Scott
cde7d781d5 Fix empty table message
Bug was happening because:

```python
bool(list())
>>> False
```

```python
bool((item for item in list()))
>>> True
```

i.e. generator expressions cast to boolean are `True`, even if they’re
empty – Python doesn’t evaluate them.

This was causing the functional tests to fail because it was taking too
long for any table rows to appear on the page.
2017-06-23 13:37:05 +01:00
Chris Hill-Scott
67b2937123 Show full message content on notification page
We’ve had a few teams talk about wanting to go back and check what their
users are sending out, including the content of any placeholders.

We already provide this functionality through the API, this commit makes
it the default in the admin app too.

We couldn’t do this before because we didn’t have the individual
notification page.

It’s better to do this by re-hydrating the template than pulling the
content from the API, because things like letters have multiple areas
of content – this is more complex than what we can get from API at the
moment.
2017-06-21 16:20:45 +01:00
Leo Hemsted
d47c2cdf9f remove dupe fixture 2017-06-20 10:51:25 +01:00
Leo Hemsted
580c225ca2 Change client_request so its kwargs look more like url_for 2017-06-19 12:31:14 +01:00
Leo Hemsted
20bb34849d add tests for notification status page 2017-06-16 15:29:34 +01:00
Chris Hill-Scott
f6d8e55579 Add two-way messaging view
> Once an inbound message has been received, there should be a way to
> see the other messages in the system from the same service to the same
> number. Both in and outbound. Nice inbox/whatsapp stylee view or some
> such. This way the context of the reply is understood.
>
> Initially will only see the outbound template, not the actual message,
> but we’re going to change this for the rest (soon), so that you can
> always see the full message for all outbound.
2017-06-10 12:03:10 +01:00
minglis
183c324f9a Merge pull request #1309 from alphagov/reinstate-new-rate-api
Reinstate new rate api
2017-06-08 14:07:33 +01:00