Skip to content

Commit b499547

Browse files
authored
Merge pull request #1843 from codeforboston/main
Deploy to PROD 6/24/25
2 parents 6e24365 + c9a2396 commit b499547

28 files changed

+924
-669
lines changed

firebase.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"functions": {
88
"predeploy": ["yarn build:functions"],
99
"source": "functions",
10-
"runtime": "nodejs18"
10+
"runtime": "nodejs18",
11+
"runtimeConfig": ".runtimeconfig.json"
1112
},
1213
"firestore": {
1314
"rules": "firestore.rules",

firestore.rules

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,16 @@ service cloud.firestore {
8989
allow read, write: if request.auth.token.get("role", "user") == "admin"
9090
}
9191
}
92+
match /transcriptions/{tid} {
93+
// public, read-only
94+
allow read: if true
95+
allow write: if false
96+
97+
// public, read-only
98+
match /utterances/{uid} {
99+
allow read: if true
100+
allow write: if false
101+
}
102+
}
92103
}
93104
}

functions/.runtimeconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"runtime": {
3+
"nodejs18": {
4+
"apt": {
5+
"packages": ["ffmpeg"]
6+
}
7+
}
8+
}
9+
}

functions/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"date-fns": "^2.30.0",
2121
"firebase-admin": "^10",
2222
"firebase-functions": "^3.22.0",
23+
"fluent-ffmpeg": "^2.1.3",
2324
"fuse.js": "6.5.3",
2425
"handlebars": "^4.7.8",
2526
"js-sha256": "^0.11.0",
@@ -34,6 +35,7 @@
3435
"zod": "^3.20.2"
3536
},
3637
"devDependencies": {
38+
"@types/fluent-ffmpeg": "^2.1.27",
3739
"@types/jest": "^27.4.0",
3840
"@types/jsdom": "^21.1.7",
3941
"@types/luxon": "^2.0.9",

functions/src/email/digestEmail.handlebars

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<html>
22
<head>
33
<title>Digest Email</title>
4-
<link rel="stylesheet" type="text/css" href="email/style.css" />
54
</head>
65

76
<body style="background: white; width: 600px; min-height: 80vh; font-family: 'Nunito';

functions/src/email/handlebarsHelpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const registerHelpers = () => {
1414
handlebars.registerHelper("minusFour", helpers.minusFour)
1515
handlebars.registerHelper("noUpdatesFormat", helpers.noUpdatesFormat)
1616
handlebars.registerHelper("toLowerCase", helpers.toLowerCase)
17+
handlebars.registerHelper("pluralize", helpers.pluralize)
1718
}
1819

1920
// Register all Handlebars partials

functions/src/email/helpers.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { BillDigest } from "../notifications/emailTypes"
2+
13
export function addCounts() {
24
let sum = 0
35
for (let i = 0; i < arguments.length - 1; i++) {
@@ -56,3 +58,12 @@ export function toLowerCase(aString: unknown) {
5658
console.error(`toLowerCase received a non-string value: ${aString}`)
5759
return undefined
5860
}
61+
62+
// TODO: This will be replaced by I18n logic when we implement it for emails
63+
export function pluralize(bill: BillDigest): string {
64+
if (bill.endorseCount + bill.neutralCount + bill.opposeCount === 1) {
65+
return "Testimony"
66+
} else {
67+
return "Testimonies"
68+
}
69+
}
Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
<article id="bill">
2-
<div style="font-weight: 500; font-size: 22px; line-height: 125%;
3-
text-decoration-line: underline; color: #000000; margin-bottom: 24px">
4-
{{this.billId}}
2+
<div style="font-weight: 500; font-size: 20px; line-height: 125%;
3+
text-decoration-line: underline; color: #000000; margin-bottom: 4px">
4+
<a href="https://mapletestimony.org/bills/{{this.billCourt}}/{{this.billId}}" target="_blank" rel="noopener noreferrer" style="color: inherit">{{this.billId}}</a>
55
</div>
6-
<div style="font-weight: 600; font-size: 12px; line-height: 125%;
6+
<div style="font-weight: 600; font-size: 16px; line-height: 125%;
77
color: #000000; letter-spacing: 0.03em; margin-bottom: 24px">
88
{{this.billName}}
99
</div>
10-
<div style="padding: 12px 0px 12px 36px; background: #EAE7E7;
11-
border-radius: 12px; margin-bottom: 36px;">
12-
<div>
13-
<div style="height: 49px; font-weight: 500; font-size: 39px; line-height: 125%;
14-
letter-spacing: -0.015em; color: #000000; margin: auto; text-align: center">
15-
{{addCounts this.endorseCount this.neutralCount this.opposeCount}}
10+
<a href="https://mapletestimony.org/bills/{{this.billCourt}}/{{this.billId}}" target="_blank" rel="noopener noreferrer" style="text-decoration: none; color: inherit">
11+
<div style="padding: 12px 0px 12px 12px; background: #EAE7E7;
12+
border-radius: 12px; margin-bottom: 12px; text-align: center">
13+
<div>
14+
<div style="height: 49px; font-weight: 500; font-size: 39px; line-height: 125%;
15+
letter-spacing: -0.015em; color: #000000; margin: auto; text-align: center">
16+
{{addCounts this.endorseCount this.neutralCount this.opposeCount}}
17+
</div>
18+
</div>
19+
<div style="height: 20px; font-weight: 700; font-size: 16px; line-height: 125%;
20+
letter-spacing: 0.015em; color: #3E3E3E; margin: auto; text-align: center">
21+
New {{pluralize this}}
22+
</div>
23+
<div style="height: 19px; font-weight: 700; font-size: 14px; line-height: 100%;
24+
color: #000000; margin: auto; padding: 16px 0px 26px 0px;
25+
text-align: center">
26+
<img src="https://mapletestimony.org/email/images_no-svgs/endorse.png" alt="checkmark" style="padding-right: 18px"/>
27+
{{this.endorseCount}} Endorse
28+
<img src="https://mapletestimony.org/email/images_no-svgs/neutral.png" alt="dash" style="padding: 0 18px"/>
29+
{{this.neutralCount}} Neutral
30+
<img src="https://mapletestimony.org/email/images_no-svgs/oppose.png" alt="x-mark" style="padding: 0 18px"/>
31+
{{this.opposeCount}} Oppose
1632
</div>
1733
</div>
18-
<div style="height: 20px; font-weight: 700; font-size: 16px; line-height: 125%;
19-
letter-spacing: 0.015em; color: #3E3E3E; margin: auto; text-align: center">
20-
New Testimonies
21-
</div>
22-
<div style="height: 19px; font-weight: 700; font-size: 14px; line-height: 100%;
23-
color: #000000; margin: auto; padding: 16px 0px 26px 0px;
24-
text-align: center">
25-
<img src="email\images_no-svgs\endorse.png" alt="checkmark" style="padding-right: 18px"/>
26-
{{!-- replace with link to mapletestimony.org when going live --}}
27-
{{this.endorseCount}} Endorse
28-
<img src="email\images_no-svgs\neutral.png" alt="dash" style="padding: 0 18px"/>
29-
{{!-- replace with link to mapletestimony.org when going live --}}
30-
{{this.neutralCount}} Neutral
31-
<img src="email\images_no-svgs\oppose.png" alt="x-mark" style="padding: 0 18px"/>
32-
{{!-- replace with link to mapletestimony.org when going live --}}
33-
{{this.opposeCount}} Oppose
34-
</div>
35-
</div>
34+
</a>
3635
</article>

functions/src/email/partials/bills/bills.handlebars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
</div>
1818
<div>
1919
{{#ifGreaterThan numBillsWithNewTestimony 4}}
20-
<div style="padding: 12px 0px 12px 36px; background: #EAE7E7;
20+
<div style="padding: 12px 0px 12px 12px; background: #EAE7E7;
2121
border-radius: 12px; margin-bottom: 36px;">
22-
<div style="font-weight: 700; font-size: 14px; line-height: 125%; letter-spacing: 3%; margin-top: 5px">
22+
<div style="font-weight: 700; font-size: 14px; line-height: 125%; letter-spacing: 3%; margin-top: 5px; text-align: center">
2323
{{#ifGreaterThan numBillsWithNewTestimony 5}}
2424
{{minusFour numBillsWithNewTestimony}} other bills you follow received testimony since your last update
2525
{{else}}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
<div id="logo" style="background-color: #1a3185; padding: 16px 20px 16px 50px">
1+
<div id="logo" style="background-color: #1a3185; padding: 16px 20px 16px 50px; text-align: center;">
22
<img src="https://mapletestimony.org/email/images_no-svgs/Logo.png" alt="Maple Logo" />
33
</div>
44

55
<header style="background-color: #FFFFFF; padding: 24px 0px 12px;
6-
gap: 16px">
6+
gap: 16px; text-align: center;">
77
<div>
88
<h2 style="font-weight: 700; font-size: 31px; line-height: 125%; margin: auto; width: 70%; color: #1a3185">
99
Here is your
1010
{{toLowerCase notificationFrequency}}
1111
report
1212
</h2>
1313
<h2 style="font-weight: 700; font-size: 31px; line-height: 125%; margin: auto; width: 80%; color: #1a3185">
14-
of the Bills and Users you follow!
14+
of the bills and users you follow!
1515
</h2>
16-
<p class="subheadline blue center" style="font-weight: 600; font-size: 12px; line-height: 125%;
16+
<p class="subheadline blue center" style="font-weight: 600; font-size: 16px; line-height: 125%;
1717
color: #1a3185; display: block; margin: auto; width: 30%">
1818
{{formatDate startDate}} - {{formatDate endDate}}
1919
</p>
2020
</div>
21-
<img src="https://mapletestimony.org/email/images_no-svgs/Mail Report.png" alt="Report" style="display: block; margin: auto; width: 32%" />
21+
<img src="https://mapletestimony.org/email/images_no-svgs/Mail Report.png" alt="Report" style="display: block; margin: auto; width: 16%" />
2222
</header>

0 commit comments

Comments
 (0)