Merge pull request #883 from omnivore-app/fix/unarchive-article-if-saved-again
fix/unarchive article if saved again
This commit is contained in:
@ -338,7 +338,7 @@ export const createArticleResolver = authorized<
|
||||
articleToSave.id = newPageId
|
||||
} else {
|
||||
// update existing page's state from processing to succeeded
|
||||
articleToSave.archivedAt = archive ? saveTime : undefined
|
||||
articleToSave.archivedAt = archive ? saveTime : null
|
||||
const updated = await updatePage(pageId, articleToSave, {
|
||||
...ctx,
|
||||
uid,
|
||||
|
||||
@ -77,6 +77,7 @@ const createArticleQuery = (
|
||||
id
|
||||
title
|
||||
content
|
||||
isArchived
|
||||
}
|
||||
user {
|
||||
id
|
||||
@ -371,6 +372,41 @@ describe('Article API', () => {
|
||||
pageId = res.body.data.createArticle.createdArticle.id
|
||||
})
|
||||
})
|
||||
|
||||
context('when saving an archived article', () => {
|
||||
before(async () => {
|
||||
url = 'https://example.com/saving-archived-article.com'
|
||||
source = 'puppeteer-parse'
|
||||
document = '<p>test</p>'
|
||||
title = 'new title'
|
||||
|
||||
await createPage(
|
||||
{
|
||||
content: document,
|
||||
createdAt: new Date(),
|
||||
hash: 'test hash',
|
||||
id: '',
|
||||
pageType: PageType.Article,
|
||||
readingProgressAnchorIndex: 0,
|
||||
readingProgressPercent: 0,
|
||||
savedAt: new Date(),
|
||||
slug: 'test saving an archived article slug',
|
||||
state: ArticleSavingRequestStatus.Succeeded,
|
||||
title,
|
||||
userId: user.id,
|
||||
url,
|
||||
archivedAt: new Date(),
|
||||
},
|
||||
ctx
|
||||
)
|
||||
})
|
||||
|
||||
it('should unarchive the article', async () => {
|
||||
const res = await graphqlRequest(query, authToken).expect(200)
|
||||
|
||||
expect(res.body.data.createArticle.createdArticle.isArchived).to.false
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('GetArticle', () => {
|
||||
|
||||
Reference in New Issue
Block a user