forked from omnivore-app/omnivore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request omnivore-app#4350 from omnivore-app/feature/archiv…
…e-account feature/archive account
- Loading branch information
Showing
17 changed files
with
101 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export const DEFAULT_HOME_PATH = '/home' | ||
export const ARCHIVE_ACCOUNT_PATH = '/account-archived' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ describe('Newsletters API', () => { | |
.post('/local/debug/fake-user-login') | ||
.send({ fakeEmail: user.email }) | ||
|
||
authToken = res.body.authToken | ||
authToken = res.body.authToken as string | ||
}) | ||
|
||
after(async () => { | ||
|
@@ -65,14 +65,8 @@ describe('Newsletters API', () => { | |
|
||
before(async () => { | ||
// create test newsletter emails | ||
const newsletterEmail1 = await createNewsletterEmail( | ||
user.id, | ||
'[email protected]' | ||
) | ||
const newsletterEmail2 = await createNewsletterEmail( | ||
user.id, | ||
'[email protected]' | ||
) | ||
const newsletterEmail1 = await createNewsletterEmail(user.id) | ||
const newsletterEmail2 = await createNewsletterEmail(user.id) | ||
newsletterEmails = [newsletterEmail1, newsletterEmail2] | ||
|
||
// create testing subscriptions | ||
|
@@ -89,7 +83,9 @@ describe('Newsletters API', () => { | |
it('responds with newsletter emails sort by created_at desc', async () => { | ||
const response = await graphqlRequest(query, authToken).expect(200) | ||
expect( | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
response.body.data.newsletterEmails.newsletterEmails.map((e: any) => { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return { | ||
...e, | ||
createdAt: | ||
|
@@ -124,10 +120,7 @@ describe('Newsletters API', () => { | |
|
||
before(async () => { | ||
// create test newsletter emails | ||
newsletterEmail = await createNewsletterEmail( | ||
user.id, | ||
'[email protected]' | ||
) | ||
newsletterEmail = await createNewsletterEmail(user.id) | ||
|
||
// create unsubscribed subscriptions | ||
await createSubscription( | ||
|
@@ -190,7 +183,7 @@ describe('Newsletters API', () => { | |
const response = await graphqlRequest(query, authToken, { | ||
input: { | ||
folder, | ||
} | ||
}, | ||
}).expect(200) | ||
const newsletterEmail = await findNewsletterEmailById( | ||
response.body.data.createNewsletterEmail.newsletterEmail.id | ||
|
@@ -239,10 +232,7 @@ describe('Newsletters API', () => { | |
context('when newsletter email exists', () => { | ||
before(async () => { | ||
// create test newsletter emails | ||
const newsletterEmail = await createNewsletterEmail( | ||
user.id, | ||
'[email protected]' | ||
) | ||
const newsletterEmail = await createNewsletterEmail(user.id) | ||
newsletterEmailId = newsletterEmail.id | ||
}) | ||
|
||
|
@@ -254,7 +244,7 @@ describe('Newsletters API', () => { | |
it('responds with status code 200', async () => { | ||
const response = await graphqlRequest(query, authToken).expect(200) | ||
const newsletterEmail = await findNewsletterEmailByAddress( | ||
response.body.data.deleteNewsletterEmail.newsletterEmail.id | ||
response.body.data.deleteNewsletterEmail.newsletterEmail.address | ||
) | ||
expect(newsletterEmail).to.be.null | ||
}) | ||
|
14 changes: 14 additions & 0 deletions
14
packages/db/migrations/0187.do.allow_admin_to_delete_filters.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Type: DO | ||
-- Name: allow_admin_to_delete_filters | ||
-- Description: Add permissions to delete data from filters table to the omnivore_admin role | ||
|
||
BEGIN; | ||
|
||
GRANT SELECT, INSERT, UPDATE, DELETE ON omnivore.filters TO omnivore_admin; | ||
|
||
CREATE POLICY filters_admin_policy on omnivore.filters | ||
FOR ALL | ||
TO omnivore_admin | ||
USING (true); | ||
|
||
COMMIT; |
11 changes: 11 additions & 0 deletions
11
packages/db/migrations/0187.undo.allow_admin_to_delete_filters.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Type: UNDO | ||
-- Name: allow_admin_to_delete_filters | ||
-- Description: Add permissions to delete data from filters table to the omnivore_admin role | ||
|
||
BEGIN; | ||
|
||
DROP POLICY filters_admin_policy on omnivore.filters; | ||
|
||
REVOKE SELECT, INSERT, UPDATE, DELETE ON omnivore.filters FROM omnivore_admin; | ||
|
||
COMMIT; |
9 changes: 9 additions & 0 deletions
9
packages/db/migrations/0188.do.add_archived_status_to_user.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Type: DO | ||
-- Name: add_archived_status_to_user | ||
-- Description: Add ARCHIVED status to the user table | ||
|
||
BEGIN; | ||
|
||
ALTER TYPE user_status_type ADD VALUE IF NOT EXISTS 'ARCHIVED'; | ||
|
||
COMMIT; |
9 changes: 9 additions & 0 deletions
9
packages/db/migrations/0188.undo.add_archived_status_to_user.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Type: UNDO | ||
-- Name: add_archived_status_to_user | ||
-- Description: Add ARCHIVED status to the user table | ||
|
||
BEGIN; | ||
|
||
ALTER TYPE user_status_type DROP VALUE IF EXISTS 'ARCHIVED'; | ||
|
||
COMMIT; |