skip publishing event for importing
This commit is contained in:
@ -527,7 +527,8 @@ export const createLibraryItems = async (
|
||||
export const createLibraryItem = async (
|
||||
libraryItem: DeepPartial<LibraryItem>,
|
||||
userId: string,
|
||||
pubsub = createPubSubClient()
|
||||
pubsub = createPubSubClient(),
|
||||
skipPubSub = false
|
||||
): Promise<LibraryItem> => {
|
||||
const newLibraryItem = await authTrx(
|
||||
async (tx) =>
|
||||
@ -541,6 +542,10 @@ export const createLibraryItem = async (
|
||||
userId
|
||||
)
|
||||
|
||||
if (skipPubSub) {
|
||||
return newLibraryItem
|
||||
}
|
||||
|
||||
await pubsub.entityCreated<DeepPartial<LibraryItem>>(
|
||||
EntityType.PAGE,
|
||||
{
|
||||
|
||||
@ -7,7 +7,6 @@ import { User } from '../entity/user'
|
||||
import { homePageURL } from '../env'
|
||||
import {
|
||||
ArticleSavingRequestStatus,
|
||||
HighlightType,
|
||||
Maybe,
|
||||
PreparedDocumentInput,
|
||||
SaveErrorCode,
|
||||
@ -144,7 +143,12 @@ export const savePage = async (
|
||||
)
|
||||
} else {
|
||||
// do not publish a pubsub event if the item is imported
|
||||
const newItem = await createLibraryItem(itemToSave, user.id)
|
||||
const newItem = await createLibraryItem(
|
||||
itemToSave,
|
||||
user.id,
|
||||
undefined,
|
||||
isImported
|
||||
)
|
||||
clientRequestId = newItem.id
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user