Skip to content

Commit 0f37cf7

Browse files
authored
Merge pull request #1835 from Mephistic/fix-notif-object
Remove Old Notifications Functions
2 parents c25c018 + 3d83dce commit 0f37cf7

File tree

5 files changed

+3
-118
lines changed

5 files changed

+3
-118
lines changed

functions/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ export {
3636
populateTestimonySubmissionNotificationEvents,
3737
cleanupNotifications,
3838
deliverNotifications,
39-
httpsDeliverNotifications,
40-
httpsCleanupNotifications,
4139
updateUserNotificationFrequency
4240
} from "./notifications"
4341

functions/src/notifications/cleanupNotifications.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,3 @@ const runCleanupNotifications = async () => {
6767
export const cleanupNotifications = functions.pubsub
6868
.schedule("every 24 hours")
6969
.onRun(runCleanupNotifications)
70-
71-
export const httpsCleanupNotifications = functions.https.onRequest(
72-
async (request, response) => {
73-
try {
74-
console.log("httpsCleanupNotifications triggered")
75-
await runCleanupNotifications()
76-
console.log("DEBUG: cleanupNotifications completed")
77-
78-
response
79-
.status(200)
80-
.send(
81-
"Successfully cleaned up old notifications, topic events, and email documents"
82-
)
83-
} catch (error) {
84-
console.error("Error in httpsCleanupNotifications:", error)
85-
response.status(500).send("Internal server error")
86-
}
87-
}
88-
)

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: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22
import { publishNotifications } from "./publishNotifications"
33
import { populateBillHistoryNotificationEvents } from "./populateBillHistoryNotificationEvents"
44
import { populateTestimonySubmissionNotificationEvents } from "./populateTestimonySubmissionNotificationEvents"
5-
import {
6-
cleanupNotifications,
7-
httpsCleanupNotifications
8-
} from "./cleanupNotifications"
9-
import {
10-
deliverNotifications,
11-
httpsDeliverNotifications
12-
} from "./deliverNotifications"
5+
import { cleanupNotifications } from "./cleanupNotifications"
6+
import { deliverNotifications } from "./deliverNotifications"
137
import { updateUserNotificationFrequency } from "./updateUserNotificationFrequency"
148

159
// Export the functions
@@ -19,7 +13,5 @@ export {
1913
populateTestimonySubmissionNotificationEvents,
2014
cleanupNotifications,
2115
deliverNotifications,
22-
httpsDeliverNotifications,
23-
httpsCleanupNotifications,
2416
updateUserNotificationFrequency
2517
}

scripts/firebase-admin/runNotificationFunctions.ts

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)