Skip to content

Commit

Permalink
chore: send list of storage quota violators to support@web3.storage, …
Browse files Browse the repository at this point in the history
…not admin@ (#1369)
  • Loading branch information
adamalton authored May 27, 2022
1 parent 2bf1ef6 commit f5d988e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/cron/src/jobs/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function checkStorageUsed ({ db, emailService }) {

if (users.length) {
if (email.emailType === EMAIL_TYPE.User100PercentStorage) {
const adminUser = await db.getUserByEmail('admin@web3.storage')
const adminUser = await db.getUserByEmail('support@web3.storage')
const toAdmin = {
_id: adminUser._id,
email: adminUser.email,
Expand Down
6 changes: 3 additions & 3 deletions packages/cron/test/storage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('cron - check user storage quotas', () => {
beforeEach(async () => {
emailService = new EmailService({ db: dbClient, provider: EMAIL_PROVIDERS.dummy })
adminUser = await createUser(dbClient, {
email: 'admin@web3.storage',
email: 'support@web3.storage',
name: 'Web3 Storage Admin'
})

Expand Down Expand Up @@ -62,14 +62,14 @@ describe('cron - check user storage quotas', () => {
assert.equal(emailService.provider.sendEmail.callCount, 4)

// Admin email
emailService.provider.sendEmail.calledWith(EMAIL_TYPE.AdminStorageExceeded, 'admin@web3.storage')
emailService.provider.sendEmail.calledWith(EMAIL_TYPE.AdminStorageExceeded, 'support@web3.storage')

// Users email
emailService.provider.sendEmail.calledWith(EMAIL_TYPE.User75PercentStorage, 'test2@email.com')
emailService.provider.sendEmail.calledWith(EMAIL_TYPE.User85PercentStorage, 'test3@email.com')
emailService.provider.sendEmail.calledWith(EMAIL_TYPE.User100PercentStorage, 'test4@email.com')

const adminUser = await dbClient.getUserByEmail('admin@web3.storage')
const adminUser = await dbClient.getUserByEmail('support@web3.storage')
assert.ok(adminUser, 'admin user found')
const adminStorageExceeded = await dbClient.emailHasBeenSent({
userId: Number(adminUser._id),
Expand Down
4 changes: 2 additions & 2 deletions packages/db/postgres/migrations/010-add-admin-user.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ INSERT INTO public.user (
public_address
)
VALUES (
'admin@web3.storage',
'support@web3.storage',
'Web3 Storage Admin',
'Web3 Storage Admin',
'Web3 Storage Admin'
);
);

0 comments on commit f5d988e

Please sign in to comment.