Merge pull request #3314 from omnivore-app/fix/update-event

skip sending item update event for reading progress update
This commit is contained in:
Hongbo Wu 2024-01-04 15:17:08 +08:00 committed by GitHub
commit 366c97ead7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 17 deletions

View file

@ -643,8 +643,7 @@ export const saveArticleReadingProgressResolver = authorized<
uid,
readingProgressPercent,
readingProgressTopPercent,
readingProgressAnchorIndex,
pubsub
readingProgressAnchorIndex
)
if (!updatedItem) {
return { errorCodes: [SaveArticleReadingProgressErrorCode.BadData] }

View file

@ -739,8 +739,7 @@ export const updateLibraryItemReadingProgress = async (
userId: string,
bottomPercent: number,
topPercent: number | null = null,
anchorIndex: number | null = null,
pubsub = createPubSubClient()
anchorIndex: number | null = null
): Promise<LibraryItem | null> => {
// If we have a top percent, we only save it if it's greater than the current top percent
// or set to zero if the top percent is zero.
@ -787,19 +786,6 @@ export const updateLibraryItemReadingProgress = async (
}
const updatedItem = result[0][0]
await pubsub.entityUpdated<QueryDeepPartialEntity<LibraryItem>>(
EntityType.PAGE,
{
id,
readingProgressBottomPercent: updatedItem.readingProgressBottomPercent,
readingProgressTopPercent: updatedItem.readingProgressTopPercent,
readingProgressHighestReadAnchor:
updatedItem.readingProgressHighestReadAnchor,
readAt: updatedItem.readAt,
},
userId
)
return updatedItem
}