Skip to content

Commit f20d960

Browse files
authored
fix: remove inactive users only for production (#1537)
* fix: remove inactive users only for production * fix: do not send out deactivation emails instead * fix: include test environment as well
1 parent fd57c8b commit f20d960

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

apps/studio/src/server/modules/user/inactiveUsers.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { toZonedTime } from "date-fns-tz"
44

55
import type { ResourcePermission, Site, User } from "../database"
66
import type { BulkSendAccountDeactivationWarningEmailsProps } from "./types"
7+
import { env } from "~/env.mjs"
78
import {
89
sendAccountDeactivationEmail,
910
sendAccountDeactivationWarningEmail,
@@ -229,6 +230,15 @@ export const bulkDeactivateInactiveUsers = async (): Promise<void> => {
229230
return
230231
}
231232

233+
if (
234+
env.NEXT_PUBLIC_APP_ENV !== "production" &&
235+
env.NEXT_PUBLIC_APP_ENV !== "test"
236+
) {
237+
// NOTE: We do not notify users in UAT or staging environments, so as to
238+
// avoid inducing unnecessary panic
239+
return
240+
}
241+
232242
for (const { user, siteIds } of deactivatedUsersAndSiteIds) {
233243
if (siteIds.length === 0) continue
234244

0 commit comments

Comments
 (0)