-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #355 from cisagov/add-static-508-banner-text-for-l…
…ocal-dev-builds Add static 508 banner text for local dev builds and cleanup logging
- Loading branch information
Showing
4 changed files
with
25 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,18 @@ import { validateBody, wrapHandler, NotFound, Unauthorized } from './helpers'; | |
import { isGlobalWriteAdmin } from './auth'; | ||
import S3Client from '../tasks/s3-client'; | ||
|
||
// 508 Warning Banner S3 filename | ||
const bannerFileName = '508warningtext.txt'; | ||
|
||
// Default 508 Warning Banner for local dev | ||
const default508Banner = | ||
'CISA is committed to providing access for all individuals with disabilities, \ | ||
including members of the public and all employees. While this website is not \ | ||
yet fully accessible to users with disabilities as required by Section \ | ||
[508](https://cisa.gov/accessibility) federal law, CISA is working diligently \ | ||
to resolve those issues. If you experience accessibility issues, please email \ | ||
[[email protected]](mailto:[email protected]) for assistance.'; | ||
|
||
class NewNotification { | ||
@IsDateString() | ||
startDatetime?: string; | ||
|
@@ -99,8 +111,6 @@ export const list = wrapHandler(async (event) => { | |
} | ||
}); | ||
|
||
console.log('Notification.find result: ', result); | ||
|
||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(result) | ||
|
@@ -161,16 +171,28 @@ export const update = wrapHandler(async (event) => { | |
* - Notifications | ||
*/ | ||
export const get508Banner = wrapHandler(async () => { | ||
const bannerFileName = '508warningtext.txt'; | ||
// Return hardcoded banner for local builds | ||
if (process.env.IS_LOCAL) { | ||
console.log('Using default banner for 508 warning: ', default508Banner); | ||
// API Response | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(default508Banner) | ||
}; | ||
} | ||
|
||
// Handle normal S3 logic | ||
try { | ||
const client = new S3Client(); | ||
const bannerResult = await client.getEmailAsset(bannerFileName); | ||
// API Response | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(bannerResult) | ||
}; | ||
} catch (error) { | ||
console.log('S3 Banner Error: ', error); | ||
// API Error Response | ||
return { | ||
statusCode: 500, | ||
body: 'Error retrieving file from S3. See details in logs.' | ||
|