resolve conflicts after rebasing
This commit is contained in:
@ -230,7 +230,7 @@ const triggerActions = async (
|
||||
logger.info('Failed to filter items by metadata, running search query')
|
||||
const searchResult = await searchLibraryItems(
|
||||
{
|
||||
query: `includes:${libraryItemId} AND (${rule.filter})`,
|
||||
query: `includes:${data.id} AND (${rule.filter})`,
|
||||
size: 1,
|
||||
},
|
||||
userId
|
||||
|
||||
@ -13,10 +13,10 @@ import { enqueueUpdateHighlight } from '../utils/createTask'
|
||||
import { deepDelete } from '../utils/helpers'
|
||||
import { ItemEvent } from './library_item'
|
||||
|
||||
const columnToDelete = ['user', 'sharedAt', 'libraryItem'] as const
|
||||
type ColumnToDeleteType = typeof columnToDelete[number]
|
||||
const columnsToDelete = ['user', 'sharedAt', 'libraryItem'] as const
|
||||
type ColumnsToDeleteType = typeof columnsToDelete[number]
|
||||
export type HighlightEvent = Merge<
|
||||
Omit<DeepPartial<Highlight>, ColumnToDeleteType>,
|
||||
Omit<DeepPartial<Highlight>, ColumnsToDeleteType>,
|
||||
EntityEvent
|
||||
>
|
||||
|
||||
@ -63,12 +63,12 @@ export const createHighlight = async (
|
||||
userId
|
||||
)
|
||||
|
||||
const cleanData = deepDelete(newHighlight, columnToDelete)
|
||||
const data = deepDelete(newHighlight, columnsToDelete)
|
||||
await pubsub.entityCreated<ItemEvent>(
|
||||
EntityType.HIGHLIGHT,
|
||||
{
|
||||
id: libraryItemId,
|
||||
highlights: [cleanData],
|
||||
highlights: [data],
|
||||
// for Readwise
|
||||
originalUrl: newHighlight.libraryItem.originalUrl,
|
||||
title: newHighlight.libraryItem.title,
|
||||
|
||||
@ -15,10 +15,10 @@ import { bulkEnqueueUpdateLabels } from '../utils/createTask'
|
||||
import { deepDelete } from '../utils/helpers'
|
||||
import { findLibraryItemIdsByLabelId, ItemEvent } from './library_item'
|
||||
|
||||
const columnToDelete = ['description', 'createdAt'] as const
|
||||
type ColumnToDeleteType = typeof columnToDelete[number]
|
||||
const columnsToDelete = ['description', 'createdAt'] as const
|
||||
type ColumnsToDeleteType = typeof columnsToDelete[number]
|
||||
export type LabelEvent = Merge<
|
||||
Omit<DeepPartial<Label>, ColumnToDeleteType>,
|
||||
Omit<DeepPartial<Label>, ColumnsToDeleteType>,
|
||||
EntityEvent
|
||||
>
|
||||
|
||||
@ -150,7 +150,7 @@ export const saveLabelsInLibraryItem = async (
|
||||
EntityType.LABEL,
|
||||
{
|
||||
id: libraryItemId,
|
||||
labels: labels.map((l) => deepDelete(l, columnToDelete)),
|
||||
labels: labels.map((l) => deepDelete(l, columnsToDelete)),
|
||||
},
|
||||
userId
|
||||
)
|
||||
|
||||
@ -32,16 +32,19 @@ import { parseSearchQuery } from '../utils/search'
|
||||
import { HighlightEvent } from './highlights'
|
||||
import { addLabelsToLibraryItem, LabelEvent } from './labels'
|
||||
|
||||
const columnToDelete = [
|
||||
const columnsToDelete = [
|
||||
'user',
|
||||
'uploadFile',
|
||||
'previewContentType',
|
||||
'links',
|
||||
'textContentHash',
|
||||
'readableContent',
|
||||
'originalContent',
|
||||
'feedContent',
|
||||
] as const
|
||||
type ColumnToDeleteType = typeof columnToDelete[number]
|
||||
type ColumnsToDeleteType = typeof columnsToDelete[number]
|
||||
type ItemBaseEvent = Merge<
|
||||
Omit<DeepPartial<LibraryItem>, ColumnToDeleteType>,
|
||||
Omit<DeepPartial<LibraryItem>, ColumnsToDeleteType>,
|
||||
{
|
||||
labels?: LabelEvent[]
|
||||
highlights?: HighlightEvent[]
|
||||
@ -889,17 +892,18 @@ export const updateLibraryItem = async (
|
||||
}
|
||||
|
||||
if (libraryItem.state === LibraryItemState.Succeeded) {
|
||||
const cleanedData = deepDelete(updatedLibraryItem, columnToDelete)
|
||||
const data = deepDelete(updatedLibraryItem, columnsToDelete)
|
||||
// send create event if the item was created
|
||||
await pubsub.entityCreated<ItemEvent>(EntityType.ITEM, cleanedData, userId)
|
||||
await pubsub.entityCreated<ItemEvent>(EntityType.ITEM, data, userId)
|
||||
|
||||
return updatedLibraryItem
|
||||
}
|
||||
|
||||
const data = deepDelete(libraryItem, columnsToDelete)
|
||||
await pubsub.entityUpdated<ItemEvent>(
|
||||
EntityType.ITEM,
|
||||
{
|
||||
...libraryItem,
|
||||
...data,
|
||||
id,
|
||||
} as ItemEvent,
|
||||
userId
|
||||
@ -1057,8 +1061,8 @@ export const createOrUpdateLibraryItem = async (
|
||||
return newLibraryItem
|
||||
}
|
||||
|
||||
const cleanedData = deepDelete(newLibraryItem, columnToDelete)
|
||||
await pubsub.entityCreated<ItemEvent>(EntityType.ITEM, cleanedData, userId)
|
||||
const data = deepDelete(newLibraryItem, columnsToDelete)
|
||||
await pubsub.entityCreated<ItemEvent>(EntityType.ITEM, data, userId)
|
||||
|
||||
return newLibraryItem
|
||||
}
|
||||
@ -1575,7 +1579,7 @@ export const filterItemEvents = (
|
||||
}
|
||||
}
|
||||
default:
|
||||
throw new Error(`Unexpected field: ${field.name}`)
|
||||
throw new RequiresSearchQueryError()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -279,22 +279,7 @@ export default function Integrations(): JSX.Element {
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: '/static/icons/notion.png',
|
||||
title: 'Notion',
|
||||
subText:
|
||||
'Notion is an all-in-one workspace. Use our Notion integration to sync your Omnivore items to Notion.',
|
||||
button: {
|
||||
text: notion ? 'Settings' : 'Connect',
|
||||
icon: <Link size={16} weight={'bold'} />,
|
||||
style: notion ? 'ctaWhite' : 'ctaDarkYellow',
|
||||
action: () => {
|
||||
notion
|
||||
? router.push('/settings/integrations/notion')
|
||||
: redirectToIntegration('NOTION')
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// {
|
||||
// icon: '/static/icons/webhooks.svg',
|
||||
// title: 'Webhooks',
|
||||
@ -331,11 +316,11 @@ export default function Integrations(): JSX.Element {
|
||||
subText:
|
||||
'Notion is an all-in-one workspace. Use our Notion integration to sync your Omnivore items to Notion.',
|
||||
button: {
|
||||
text: isConnected('NOTION') ? 'Settings' : 'Connect',
|
||||
text: notion ? 'Settings' : 'Connect',
|
||||
icon: <Link size={16} weight={'bold'} />,
|
||||
style: isConnected('NOTION') ? 'ctaWhite' : 'ctaDarkYellow',
|
||||
style: notion ? 'ctaWhite' : 'ctaDarkYellow',
|
||||
action: () => {
|
||||
isConnected('NOTION')
|
||||
notion
|
||||
? router.push('/settings/integrations/notion')
|
||||
: redirectToIntegration('NOTION')
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user