Skip to content

Commit bf1f6ae

Browse files
committed
fix(notifications): Remove unused httpsDeliverNotifications firebase function - we can manually trigger the scheduled function if need be, so this is useless. Also fixes a typo in the digest rendering that could prevent the template from rendering with data
1 parent c25c018 commit bf1f6ae

File tree

4 files changed

+2
-23
lines changed

4 files changed

+2
-23
lines changed

functions/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export {
3636
populateTestimonySubmissionNotificationEvents,
3737
cleanupNotifications,
3838
deliverNotifications,
39-
httpsDeliverNotifications,
4039
httpsCleanupNotifications,
4140
updateUserNotificationFrequency
4241
} from "./notifications"

functions/src/notifications/deliverNotifications.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -233,26 +233,11 @@ const renderToHtmlString = (digestData: NotificationEmailDigest) => {
233233
"utf8"
234234
)
235235
const compiledTemplate = handlebars.compile(templateSource)
236-
return compiledTemplate({ digestData })
236+
return compiledTemplate(digestData)
237237
}
238238

239239
// Firebase Functions
240240
export const deliverNotifications = functions.pubsub
241241
.schedule("47 9 1 * 2") // 9:47 AM on the first day of the month and on Tuesdays
242242
.timeZone("America/New_York")
243243
.onRun(deliverEmailNotifications)
244-
245-
export const httpsDeliverNotifications = functions.https.onRequest(
246-
async (request, response) => {
247-
try {
248-
await deliverEmailNotifications()
249-
250-
console.log("DEBUG: deliverNotifications completed")
251-
252-
response.status(200).send("Successfully delivered notifications")
253-
} catch (error) {
254-
console.error("Error in deliverNotifications:", error)
255-
response.status(500).send("Internal server error")
256-
}
257-
}
258-
)

functions/src/notifications/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import {
66
cleanupNotifications,
77
httpsCleanupNotifications
88
} from "./cleanupNotifications"
9-
import {
10-
deliverNotifications,
11-
httpsDeliverNotifications
12-
} from "./deliverNotifications"
9+
import { deliverNotifications } from "./deliverNotifications"
1310
import { updateUserNotificationFrequency } from "./updateUserNotificationFrequency"
1411

1512
// Export the functions
@@ -19,7 +16,6 @@ export {
1916
populateTestimonySubmissionNotificationEvents,
2017
cleanupNotifications,
2118
deliverNotifications,
22-
httpsDeliverNotifications,
2319
httpsCleanupNotifications,
2420
updateUserNotificationFrequency
2521
}

scripts/firebase-admin/runNotificationFunctions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const db = admin.firestore()
1212
const notificationFunctions: {
1313
[K in FunctionName]?: K
1414
} = {
15-
httpsDeliverNotifications: "httpsDeliverNotifications",
1615
httpsCleanupNotifications: "httpsCleanupNotifications"
1716
}
1817

0 commit comments

Comments
 (0)