Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

move report ID generation to server #1349

Merged
merged 5 commits into from
Feb 17, 2020
Merged

move report ID generation to server #1349

merged 5 commits into from
Feb 17, 2020

Conversation

sastels
Copy link
Contributor

@sastels sastels commented Feb 11, 2020

Fixes #1346

Description

Moves the code for generating the report ID to the server. This means that the client has to get the ID from the server to display on the thank you page.

To test:

  1. get the COSMOSDB environment variables from me and add to your f2/.env file
  2. npm run build && node server.js
  3. go to localhost:3000, fill out the form, and submit
  4. something like Report NCFRS-r54dyetdphg saved to CosmosDB will be printed to your console.
  5. the same report ID will display on the thank you page.

Checklist:

  • I have looked at my code on GitHub and it all looks good (ex: no random commented out code or console.logs)
  • I have added and needed tests for my changes (in particular for new screens)
  • I have added a comment to any confusing code

Required followup work

If there's a problem saving to the database, this code will set the reportId to an error message such as "Error saving to CosmosDB". If that is the case (ie if the reportId doesn't start with "NCFRS", essentially) we should display a "please come back later" error message on the thank you page.

@sastels sastels temporarily deployed to rac-prototyp-move-repor-itimqf February 11, 2020 20:31 Inactive
@sastels sastels temporarily deployed to rac-prototyp-move-repor-itimqf February 11, 2020 20:34 Inactive
@@ -8,3 +8,4 @@ data
f2/build
**/locales/*.js
platform/**/.env*
*.cer
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stop any certs generated in testing from sneaking into the repo

@lgtm-com
Copy link

lgtm-com bot commented Feb 11, 2020

This pull request fixes 1 alert when merging ba1ea3f into 96e79c5 - view on LGTM.com

fixed alerts:

  • 1 for Superfluous trailing arguments

@sastels sastels temporarily deployed to rac-prototyp-move-repor-itimqf February 13, 2020 19:09 Inactive
Copy link
Contributor

@ngosset ngosset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reportId saved to CosmosDB did not match the reportID shown to the user

reportId: 'NCFRS-3z4w976ex00'
}
Self harm words detected:
Encrypted Mail: No certs to encrypt with!
(node:27280) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
Report NCFRS-dcwxnxscsx5 saved to CosmosDB

@sastels
Copy link
Contributor Author

sastels commented Feb 13, 2020

Running the branch locally myself

npm run build
node server.js

everything worked - in particular the last file in CosmosDB had the reportID that was displayed on the thankyou page. Is it possible that you weren't actually saving to the database (despite the server claiming that the file was saved?)

I can send you the COSMOSDB env vars that I'm using.

@sastels sastels temporarily deployed to rac-prototyp-move-repor-itimqf February 13, 2020 21:29 Inactive
@ngosset
Copy link
Contributor

ngosset commented Feb 14, 2020

Running the branch locally myself

npm run build
node server.js

everything worked - in particular the last file in CosmosDB had the reportID that was displayed on the thankyou page. Is it possible that you weren't actually saving to the database (despite the server claiming that the file was saved?)

I can send you the COSMOSDB env vars that I'm using.

I'll try again today.

I did review the record in CosmosDB so was definitely saving.

Maybe my browser was serving me a cached or old version of the react-app somehow, this would probably cause the issue, I'm sure I remembered to do the npm build but maybe I re-used an existing session

@sastels sastels temporarily deployed to rac-prototyp-move-repor-itimqf February 14, 2020 12:34 Inactive
@sastels sastels temporarily deployed to rac-prototyp-move-repor-itimqf February 14, 2020 23:10 Inactive
@ngosset
Copy link
Contributor

ngosset commented Feb 17, 2020

Works for me now.

@sastels sastels merged commit 5b447bf into master Feb 17, 2020
@sastels sastels deleted the move-reportid-code branch February 17, 2020 14:49
ngosset pushed a commit that referenced this pull request Feb 25, 2020
…1558)

* Final feedback page and thanks (#1360)

* change font size in thank you box to 1.125rem=18px in thank you page (#1382)

* Privacy content update (#1366)

* change all back button copy

* Update Privacy and Consent Page content

* Fix Google analytics hopefully (#1291)

* Content changes to How did it start page  (#1373)

* change word order to make it more scannable

* english content update

* french content updates

* Email victim (#1343)

* Tweak review apps (#1372)

* Update all the impact pages and what happened pages (#1384)

* updates to money page content

* update information page content

* devices page copyedit

* update content on business page

* what happened page content edits

* Update content on suspect page (#1385)

* Update links and content on Thank you page (#1387)

* Updatedinformation (#1386)

* clear the data in the previous report when reporter wants to another
report by clicking on "create a new report" in the thank you page

* deleted unused items  Please enter the commit message for your changes. Lines starting

*  deleted unwanted line
Please enter the commit message for your changes. Lines starting

* changed fields on contact page (#1356)

* changed fields on contact page

* linted

* Mid Feedback component (#1364)

* started working on the feedback thing

* implemented the mid service feedback component

* added a test, removed typo in file name

* Updating content on What was affected page (#1375)

* content edits

* french

* remove unused tag

* Content update : File upload page and Location page (#1390)

* Update location page content for launch version

* Update file upload page copy

* remove unused P tag

Co-authored-by: ngosset <ngosset@gmail.com>

* updated name of suspectClues1 field (#1383)

* Update text in Full privacy statement (#1393)

* fix server.js (#1389)

Co-authored-by: ngosset <ngosset@gmail.com>

* Add Terms and conditions page (#1397)

* Add Terms and conditions page

* remove unused variable

* Client-side validation file upload (#1391)

* Added new and file uploading related text .

* Rearranged text to match new figma look

* Added file upload type, extensions restrictions.

* Added client side file restrictions, updated page.

* it works (#1349)

Co-authored-by: ngosset <ngosset@gmail.com>

* Improve analyst email (#1376)

* Fix file description input (#1407)

* Cleaning up content on remaining pages (#1402)

* Minor tweaks to contact page content

* Punctuation and microcopy on feedback component mid-flow

* add space after conditional text in thank you page

* change conditional text about email to not include summary of report

* clarify what happens next on thank you page

* Fixes on confirmation page content

* Update device content

* missing translations

* add new string to Device.js file

* change description to match change

* add missing translations

* fix broken test

* make link work (#1423)

* Save file to Azure Blob Storage (#1368)

* Saving file as blob to mongodb

* Moved to Azure Blob Storage

* Added to example env

* LGTM errors

* Merged with avscanner code, storing scanner result in json... refactor - ASYNC ALL THE THINGS

* Added clam url to env example

* Refactoring some more

* Missed part of the report ID on server stuff

* look at this steve

* Update review page + Fix font colour on evidence page (#1416)

* update review page

* fixes #1410

* change feedback button copy EN

* Add tips/guidance to what could be affected pages + other minor content edits (#1420)

* adding tip on how did it start page

* add alert on money page

* add tips to impact pages and fix next buttons in french

* Footer and Privacy statement links (#1415)

* Add all the links to the Full Privacy Statement (#1422)

* Remove form from full privacy statement

* Add all links to the Full Privacy Statement

* fix failing test

* missing translation

* fix email links

* remove back button to resolve test

* reformatting

* Add account field on Device and Confirmation page (#1426)

* Adding an accounts field on the Device page

* Add account field on Devices page

* fix confirmation page

* fix confirmation summary

* fix constant in summary

* Set user language based on host (#1395)

* set language based host URL

* change to if elseif statement

* if else statement

* change if statement conditions

Co-authored-by: ngosset <ngosset@gmail.com>

* Design tweaks on Landing page and Thank you page (#1399)

* thank you page feedback integration and ui fix for card. Implemented a row and column components

* linted

* added phone number to landing page link

* shorten version in footer (#1417)

* Files in analyst email (#1431)

* Real self harm words (#1432)

* FormArrayControl component and Adapters for radios and checkboxes (#1312)

* working FormArrayControl component and Adapters for radio and checkboxes

* broken, but added a Field component to ease markup

* rebuilt the howdiditstart page using checkbox component.

* lint and passing tests. Not all new components have tests

* added a test for FormArrayControl

* cleaned up inputs, they also work properly now.

* tweaked input and text-area to accept attributes from react-final-form

* passing tests

* added condition to prevent rendering of node if conditional field doesn't exist

* some tweaks to ensure correct labelling of fields

* #1312-  Added the privacy consent checkbox fixes

* #1312-  Added whatWasAffected checkbox fixes

* cleanups

* Added the money lost checkbox fixes

* Added the missing UI container

* Added the information page checkbox fixes

* Added the conditional form for single field

* Merge conflicts

* Added missing dependencies

* Updated feedback forms

* Added the final forms fixes

* Remove unwanted copy -  Not included in the mocks

Co-authored-by: khalid elaggan <khalidelaggan@users.noreply.github.com>

* Victim name not appearing on confirmation page (#1436)

* added victim name under contact info summary

* added name under hasInfoToDisplay

* Fix links + edit copy (#1437)

* microcopy change including cybertip.ca and website instead of service

* microcopy change to say website instead of form

* match button and heading for mid-service feedback

* fix privacy pages links to look the same and open externally

* fix lingui

Co-authored-by: Steve Astels <sastels@users.noreply.github.com>

* Adding DEV, Staging and PROD to pipeline (#1440)

* Revised Cancel page (#1439)

* fix button on cancel page + fix broken test on privacy page

* Revise cancelled page

* lingui file update

* remove unused variable

* fix failing test

* anything

* Small typos (#1445)

* fix french typo

* english typo

* Add skip button (#1449)

* add skip option on contact details page

* add skip option to location page

* File upload redesign (#1352)

* typo (#1451)

* remove conditional box from other on what could be affected (#1453)

* fix confirmation page when some fields are undefined (#1443)

* Hookup feedback to notify (#1447)

* Language tweaks + fix wrong language in strings (#1462)

* fix fr string in en

* fix english string appearing in french

* fix Megabytes abbreviation in FR

* fix punctuation

* update FR landing page with latest copy

* remove extra ?

* consistency app > logiciel

* french typo

* Change date format on 'Money'and 'How did it start' pages (#1438)


* Added new text for Money and How did it start pgs.

* Added input field for date in How did it start pg.

* Added  input fields for date in Money page.

* Refactored to fix merge issue, added few changes.

* fix missing lingui keys (#1477)

* Hookup content moderator (#1454)

* Added lang query param to set language (#1448)

* Added lang query param to set language

* Fixed footer inks to use queryparam. Use browser locale when all else fails

* Update i18n.config.js

* Fixed lang on hyperlinks on privacy consent and terms and conditions

* spacing on thank you page (#1480)

* Change link in T&C (#1476)

* change link in T&C

* fix conflict fix

* Mid Feedback submit  (#1478)

* using react state to manage mid feedback state

* half pages are done. Merging with master

* added mid feedback to all pages. Fixed submit visual feedback

* modified tests for mid feedback form

* linted

* fixing some layout issues

* last few tweaks for layout utilities

* lint

* merge tweaks

* test for Page

* Use our own ClamAV image (#1494)

* rearrange

* Changed SKU to premium for vnet

* scanner image from ACR

* remove bug comments

* Add initial ClamAV build

* add new date fields to analyst email (#1493)

* Final content pass for launch -- copyediting / proofreading (#1492)

* tweaking french language on landing page

* tweak to how did it start page in french

* fix apostrophes to curved in en

* final french review

* final content pass in french

* change cancel button in fr

* remove links from information alert (for now) bc glitching (#1499)

* revamped moneylost page (#1500)

* Thank you page has some logic to thank users for their feedback (#1506)

* Added conditional forms to Info page (#1505)


* Added conditional fields to information page 'other' options via new components .

* Changed components Box to React.Fragment.

* Removed reference to Box component.

* Minor changes to thank you page and copyedits (#1497)

* update order of sentence

* move email string into paragraph below

* change confirmation number line

* fix confirmation email line in email

* Howdiditstart:  hint  and date improvements (#1507)

* fixed some groups and relations with date fields, using correct Field component to display hints

* lint + removed some more unecessary markup

* Improve summary displays (#1501)

* Improve server tests (#1483)

* Resource tagging (#1524)

* Changing resource names

Graham has a new standard for RCMP Azure resource naming so I have implemented those changes here.

* Add Tagging

* Blob Storage and App Variables (#1526)

* Blob Storage and App Variables

Here I am adding all of the required app service environment variables and adding in the blob storage and configuring it.

* Implementing review comments

* removing unencrypted reports

* clear condition fields appropriately (#1522)

* close MidFeedbackForm (#1521)

* Changing names back (#1531)

* Changing names back

changing resource names back

* add uid variables

* Added basic render test for HowDidItStartForm (#1509)


* Added basic render test for HowDidItStartForm.

* format date better (#1512)

* fix for skipping location (#1514)

Co-authored-by: DianeLiu2019 <51336707+DianeLiu2019@users.noreply.github.com>

* use an env var to set whether warning banner is shown (#1519)

* All the variables (#1532)

* use unidecode module to strip accents (#1516)

* add newline if needed (#1523)

Co-authored-by: dhcdn <51758091+davidheerema@users.noreply.github.com>
Co-authored-by: DianeLiu2019 <51336707+DianeLiu2019@users.noreply.github.com>

* fixed a11y issues in feedback forms (#1496)

* A11y fixes (#1525)

* [a11y] aria landmark - fix

* [a11y] added the missing form label

* Updated the color tone slightly to meet WCAG requirement

* Adding a darker shade for the active state

* Added in another PR

* show self harm words at the top of intake report (#1515)

* Fixes for Azure Build Script after test run (#1537)

* Fix command typo

* Add sleep and comments

* fix db name

* updaing blob name

* string escape changes

* metrics typo

* add app info-best viewed with Chrome or Firefox  on landing page (#1541)

* add app info-best viewed with Chrome or Firefox  on landing page

* update copy in alert and only have one alert per page

* edit string

Co-authored-by: Anik Brazeau <38330843+anikbrazeau@users.noreply.github.com>

* show "other" checkbox option (#1540)

* show "other "( chosen from how did it start page ) in confirmation page "I was contacted other"  (#1495)

* make size of text bigger on evidence page (#1536)

* [#1527 - #1467] Removed the Landing page side by side landing boxes (#1542)

* Removed the Landing page side by side containers

* Removed unused packages

* Removed unused package

* removed call button, fixed spacing between things

* linted

Co-authored-by: amazingphilippe <amazingphilippe@gmail.com>

* [#1527 - #1467] Removed the Landing page side by side landing boxes (#1542)

* Removed the Landing page side by side containers

* Removed unused packages

* Removed unused package

* removed call button, fixed spacing between things

* linted

Co-authored-by: amazingphilippe <amazingphilippe@gmail.com>

* Update azurescript.sh (#1545)

* Update Build Arg Variable (#1553)

Co-authored-by: ngosset <ngosset@gmail.com>

Co-authored-by: Steve Astels <sastels@users.noreply.github.com>
Co-authored-by: DianeLiu2019 <51336707+DianeLiu2019@users.noreply.github.com>
Co-authored-by: Anik Brazeau <38330843+anikbrazeau@users.noreply.github.com>
Co-authored-by: amazingphilippe <amazingphilippe@gmail.com>
Co-authored-by: naomiseminega <58989481+naomiseminega@users.noreply.github.com>
Co-authored-by: kevinyang06 <58781425+kevinyang06@users.noreply.github.com>
Co-authored-by: khalid elaggan <khalidelaggan@users.noreply.github.com>
Co-authored-by: dhcdn <51758091+davidheerema@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move reportID generation code to server.js
2 participants