Skip to content

Commit

Permalink
Merge pull request #3286 from omnivore-app/fix/highlights-in-update-s…
Browse files Browse the repository at this point in the history
…ince-api

fix type of highlight is null from update since api
  • Loading branch information
sywhb authored Dec 28, 2023
2 parents 02ba27c + 881626d commit 90195f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/api/src/resolvers/function_resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { findLabelsByLibraryItemId } from '../services/labels'
import { findRecommendationsByLibraryItemId } from '../services/recommendation'
import { findUploadFileById } from '../services/upload_file'
import {
highlightDataToHighlight,
isBase64Image,
recommandationDataToRecommendation,
validatedDate,
Expand Down Expand Up @@ -451,7 +452,8 @@ export const functionResolvers = {
if (item.highlights) return item.highlights

if (item.highlightAnnotations && item.highlightAnnotations.length > 0) {
return findHighlightsByLibraryItemId(item.id, ctx.uid)
const highlights = await findHighlightsByLibraryItemId(item.id, ctx.uid)
return highlights.map(highlightDataToHighlight)
}

return []
Expand Down
5 changes: 5 additions & 0 deletions packages/api/test/resolvers/article.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { User } from '../../src/entity/user'
import {
ArticleSavingRequestStatus,
BulkActionType,
HighlightType,
PageType,
SyncUpdatedItemEdge,
UpdateReason,
Expand Down Expand Up @@ -1963,6 +1964,7 @@ describe('Article API', () => {
pageType
highlights {
id
type
}
}
itemID
Expand Down Expand Up @@ -2084,6 +2086,9 @@ describe('Article API', () => {
expect(res.body.data.updatesSince.edges[0].node.highlights[0].id).to.eq(
highlight.id
)
expect(res.body.data.updatesSince.edges[0].node.highlights[0].type).to.eq(
HighlightType.Highlight
)
})
})
})
Expand Down

1 comment on commit 90195f2

@vercel
Copy link

@vercel vercel bot commented on 90195f2 Dec 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.