Commit Graph

7393 Commits

Author SHA1 Message Date
Alexey Bezhan
fce80b87b7 Move jshint configuration to .jshintrc
When provided with inline configuration in a gulp task jshint will
still try to load a configuration file from the current directory
or the user's home directory. If user has a global .jshintrc file
that sets different linting options this could lead to `npm test`
output being different from the CI one.

jshint only uses the first file it finds, and .jshintrc in current
directory or any parent of the current directory takes precedence
over the user one, so moving jshint configuration from gulpfile to
.jshintrc should make `npm test` produce the same outcome regardless
of the user config.
2017-11-06 17:37:15 +00:00
Leo Hemsted
4aeb57567a remove flask-script
flask-script has been deprecated by the internal flask.cli module, but
making this carries a few changes with it

* you should add FLASK_APP=application.py and FLASK_DEBUG=1 to your
  environment.sh.
* instead of using `python app.py runserver`, now you must run
  `flask run -p 6012`. The -p command is important - the port must be
  set before the config is loaded, so that it can live reload nicely.
  (https://github.com/pallets/flask/issues/2113#issuecomment-268014481)
* find available commands by just running `flask`.
* run them using flask. eg `flask list_routes`
* define new tasks by giving them the decorator
  `@app.cli.command('task-name')`. Task name isn't needed if it's just
  the same as the function name. Alternatively, if app isn't available
  in the current scope, you can invoke the decorator directly, as seen
  in app/commands.py
2017-11-06 17:33:04 +00:00
Pete Herlihy
430c67e538 102 - 103 for FormFinder Admin MOJ 2017-11-06 16:34:34 +00:00
Chris Hill-Scott
ba2c5a6ee2 Merge pull request #1615 from alphagov/pyup-update-pyexcel-xlsx-0.5.2-to-0.5.4
Update pyexcel-xlsx to 0.5.4
2017-11-06 15:49:14 +00:00
pyup-bot
3c9ef52ffb Update pyexcel-xlsx from 0.5.2 to 0.5.4 2017-11-06 15:45:20 +00:00
Chris Hill-Scott
095845109f Merge pull request #1610 from alphagov/allow-updates-to-sms-prefixing
Allow updates to SMS prefixing setting
2017-11-06 15:43:20 +00:00
Chris Hill-Scott
9e52958fab Merge pull request #1607 from alphagov/pyup-update-pyexcel-xls-0.5.2-to-0.5.4
Update pyexcel-xls to 0.5.4
2017-11-06 15:43:08 +00:00
Chris Hill-Scott
9e600b6051 POST to the correct endpoint when updating
`prefix_sms_with_service_name` is a computed attribute on the service
model. It’s where we get the value from, and the API does some work to
get it from the database, or derive it from the default SMS sender.
It can’t be updated, because it’s not itself a database column.

`prefix_sms` is the name of the actual database column. This is the
thing that we need to update.

This will go away eventually.
2017-11-06 15:08:34 +00:00
Chris Hill-Scott
31497945c0 Change wording based on Thom’s feedback 2017-11-06 14:12:25 +00:00
Chris Hill-Scott
f329e138cd Factor out string escaping code
So that it only lives in one place.
2017-11-06 13:24:16 +00:00
Chris Hill-Scott
f6950ae987 Stop escaping special characters in inbound
At least one of our providers gives us messages with special characters
escaped, ie a newline comes through as `\n`, not a literal newline. We
shouldn’t be showing these backslashes to any of our users.

Python has built in codecs for dealing with encoding/decoding of
strings – see
https://docs.python.org/3/library/codecs.html#text-encodings
for details. Using these builtins is safer than trying to do anything
regex or parsing-based.
2017-11-06 13:24:16 +00:00
Chris Hill-Scott
fed4275403 Factor out code that gets message content
The nesting is getting pretty deep here. Let’s make it into its own
method so it doesn’t get out of hand when we add more functionality to
it.
2017-11-06 13:10:02 +00:00
pyup-bot
0071e37e61 Update notifications-python-client from 4.5.0 to 4.6.0 2017-11-06 11:47:51 +00:00
Chris Hill-Scott
6d3855bba4 Allow updates to SMS prefixing setting
We’re extracting this from being determined based on what the sender
name is to its own setting.

This commit will let users set it independently.

Until the explicitly set it, it will still be determined based on
whether their default sender name matches the default for the platform.
2017-11-06 11:24:46 +00:00
Chris Waszczuk
db8f7032fe Merge pull request #1612 from alphagov/fix-analytics-csp
Stop content security policy blocking GA
2017-11-06 10:45:51 +00:00
Chris Hill-Scott
1d10ad2247 Stop content security policy blocking GA
In https://github.com/alphagov/notifications-admin/pull/1583 we changed
our Google Analytics settings to use newer browsers’ `sendBeacon`
feature. The advantage of this is that it

> [ensures] that the data has been sent during the unloading of a
> document [which] is something that has traditionally been difficult
> for developers

– https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon

To transmit this data it uses a AJAX request (`XMLHttpRequest`)
underneath. AJAX requests are governed by the `connect-src` content
security policy (or the `default-src` if one is not present).
`connect-src`:

> Applies to XMLHttpRequest (AJAX), WebSocket or EventSource. If not
> allowed the browser emulates a 400 HTTP status code.

– https://content-security-policy.com/

Because we didn’t have one in place, `sendBeacon` requests to GA were
getting blocked in browsers that support content security policy (pretty
much everything better than IE11[1]).

1. https://caniuse.com/#feat=beacon
2017-11-06 10:25:30 +00:00
Chris Waszczuk
98c8ddca38 Merge pull request #1598 from gov-cjwaszczuk/master
Email auth for inviting members and editing permissions
2017-11-06 10:00:15 +00:00
Pete Herlihy
8985f3978e Merge pull request #1611 from alphagov/inbound-callback
Inbound callback page
2017-11-03 16:22:48 +00:00
Chris Hill-Scott
240f25eaf9 Fix failing tests 2017-11-03 16:15:39 +00:00
Chris Hill-Scott
c19855c0b0 Fix missing import 2017-11-03 16:12:37 +00:00
Pete Herlihy
60a39b2e49 Updated the callbacks page to add the link to new documentation. 2017-11-03 16:10:26 +00:00
Pete Herlihy
55093691f1 Updated test to reflect new label on callback URL field 2017-11-03 16:05:10 +00:00
Pete Herlihy
431e269cf9 Updated the field label for the callback URL 2017-11-03 16:02:43 +00:00
Pete Herlihy
4b2ba34d68 Updated the label to set the callback URL on the settings page 2017-11-03 14:25:31 +00:00
Pete Herlihy
bc7af49b56 New page explaining the format of callback messages 2017-11-03 14:24:10 +00:00
Chris Hill-Scott
c0f1de2342 Merge pull request #1596 from alphagov/extra-letter-spacing-phone-search
Add extra letter spacing to phone number search
2017-11-03 14:20:21 +00:00
Chris Hill-Scott
2ed46b6458 Merge pull request #1606 from tuzz/fix-a-typo
Fix a typo: generates -> generate
2017-11-03 14:20:15 +00:00
Chris Hill-Scott
0b35f70023 Merge pull request #1609 from alphagov/use-service-property-to-prefix-sms
Use service setting to determine prefixing of SMSs
2017-11-03 14:19:24 +00:00
Chris Hill-Scott
ba128d05bc Use service setting to determine prefixing of SMSs
Rather than doing this nasty `if` statement, let the API work out what
to do. Also means that the logic is not repeated between the two apps.
2017-11-03 13:14:10 +00:00
Pete Herlihy
9eb83792cf Added test for new callbacks static page 2017-11-03 11:57:29 +00:00
Pete Herlihy
2c74027e0d Adding a route for 'callbacks' page
Gone with callbacks as this page may be extended for delivery receipts in the future.
2017-11-03 11:56:15 +00:00
pyup-bot
660ef8db6b Update pyexcel-xls from 0.5.2 to 0.5.4 2017-11-02 23:32:46 +00:00
Rebecca Law
fa6e4971c9 Merge pull request #1603 from alphagov/sms-sender-for-one-off
Select text message sender for one off notifications
2017-11-02 16:35:51 +00:00
Rebecca Law
3e10cfb165 Rename test 2017-11-02 16:30:49 +00:00
Rebecca Law
edf0e0ec13 Merge pull request #1604 from alphagov/fix-format-on-trial-service
Fix some formatting on the trial mode services page
2017-11-02 16:28:04 +00:00
Rebecca Law
ff22c83b1d Added a hint to show default and receives text messages 2017-11-02 15:48:19 +00:00
Rebecca Law
83bfc50884 Added a hint for Receives replies 2017-11-02 14:58:14 +00:00
Leo Hemsted
3c034a43b9 Merge pull request #1605 from alphagov/invitation-expiry-fix
make sure old invites get the proper err message
2017-11-02 14:03:35 +00:00
Chris Patuzzo
5152fa8e82 Fix a typo: generates -> generate 2017-11-02 13:51:00 +00:00
Leo Hemsted
04adb15e85 make sure old invites get the proper message
we were accidentally covering up the expiry message with a more
generic one
2017-11-02 13:49:24 +00:00
Rebecca Law
3f1c543735 Fix some formatting on the trial mode services page 2017-11-02 13:39:37 +00:00
chrisw
c6ea90a7d8 Email auth for inviting members and editing permissions 2017-11-02 12:38:01 +00:00
Rebecca Law
2ea921952f This PR adds the ability to select a text message sender if more than one exist for the service. 2017-11-02 12:07:46 +00:00
Rebecca Law
5e175954d2 Merge pull request #1600 from alphagov/add-letters-to-platform-admin
Add letter counts to the platform admin page.
2017-11-02 10:16:02 +00:00
Leo Hemsted
e6f5b08f21 Merge pull request #1592 from alphagov/load-service-err
make sure load_service_before_request handles 404s
2017-11-01 16:47:25 +00:00
Leo Hemsted
80b5af6ed9 Merge branch 'master' into load-service-err 2017-11-01 16:43:51 +00:00
Leo Hemsted
6742560b33 Merge pull request #1599 from alphagov/new-acc-email-validation
New account verification emails no longer call API
2017-11-01 16:43:04 +00:00
Pete Herlihy
1d2b761161 Merge pull request #1597 from alphagov/100-102
100-102 for GOV.UK Email and SSCSA
2017-11-01 16:38:56 +00:00
Rebecca Law
4acfd4101f Add letter counts to the platform admin page.
The big number counts are based on how many messages have been delivered. For letters we are using the requested count.
2017-11-01 16:33:06 +00:00
Leo Hemsted
9eb5e6a532 make sure invite tokens still check token on admin for error handler to kick in 2017-11-01 16:17:04 +00:00