do not show move/archived/deleted item in home feed
This commit is contained in:
@ -876,6 +876,7 @@ export const moveToFolderResolver = authorized<
|
||||
{
|
||||
folder,
|
||||
savedAt,
|
||||
seenAt: new Date(),
|
||||
},
|
||||
uid,
|
||||
pubsub
|
||||
|
||||
@ -657,7 +657,9 @@ export const functionResolvers = {
|
||||
.map((item) => item.id)
|
||||
const libraryItems = (
|
||||
await ctx.dataLoaders.libraryItems.loadMany(libraryItemIds)
|
||||
).filter((libraryItem) => !isError(libraryItem)) as Array<LibraryItem>
|
||||
).filter(
|
||||
(libraryItem) => !!libraryItem && !isError(libraryItem)
|
||||
) as Array<LibraryItem>
|
||||
|
||||
const publicItemIds = section.items
|
||||
.filter((item) => item.type === 'public_item')
|
||||
|
||||
@ -79,6 +79,7 @@ export const setLinkArchivedResolver = authorized<
|
||||
{
|
||||
state,
|
||||
archivedAt,
|
||||
seenAt: new Date(),
|
||||
},
|
||||
uid
|
||||
)
|
||||
|
||||
@ -5,6 +5,8 @@ import {
|
||||
DeepPartial,
|
||||
EntityManager,
|
||||
FindOptionsWhere,
|
||||
In,
|
||||
IsNull,
|
||||
ObjectLiteral,
|
||||
} from 'typeorm'
|
||||
import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity'
|
||||
@ -133,26 +135,34 @@ export enum SortBy {
|
||||
const readingProgressDataSource = new ReadingProgressDataSource()
|
||||
|
||||
export const batchGetLibraryItems = async (ids: readonly string[]) => {
|
||||
const items = await findLibraryItemsByIds(ids as string[], undefined, {
|
||||
select: [
|
||||
'id',
|
||||
'title',
|
||||
'author',
|
||||
'thumbnail',
|
||||
'wordCount',
|
||||
'savedAt',
|
||||
'originalUrl',
|
||||
'directionality',
|
||||
'description',
|
||||
'subscription',
|
||||
'siteName',
|
||||
'siteIcon',
|
||||
'archivedAt',
|
||||
'deletedAt',
|
||||
'slug',
|
||||
'previewContent',
|
||||
],
|
||||
})
|
||||
const selectColumns: Array<keyof LibraryItem> = [
|
||||
'id',
|
||||
'title',
|
||||
'author',
|
||||
'thumbnail',
|
||||
'wordCount',
|
||||
'savedAt',
|
||||
'originalUrl',
|
||||
'directionality',
|
||||
'description',
|
||||
'subscription',
|
||||
'siteName',
|
||||
'siteIcon',
|
||||
'archivedAt',
|
||||
'deletedAt',
|
||||
'slug',
|
||||
'previewContent',
|
||||
]
|
||||
const items = await authTrx(async (tx) =>
|
||||
tx.getRepository(LibraryItem).find({
|
||||
select: selectColumns,
|
||||
where: {
|
||||
id: In(ids as string[]),
|
||||
state: LibraryItemState.Succeeded,
|
||||
seenAt: IsNull(),
|
||||
},
|
||||
})
|
||||
)
|
||||
|
||||
return ids.map((id) => items.find((item) => item.id === id) || undefined)
|
||||
}
|
||||
@ -891,6 +901,7 @@ export const softDeleteLibraryItem = async (
|
||||
await itemRepo.update(id, {
|
||||
state: LibraryItemState.Deleted,
|
||||
deletedAt: new Date(),
|
||||
seenAt: new Date(),
|
||||
})
|
||||
|
||||
return itemRepo.findOneByOrFail({ id })
|
||||
|
||||
Reference in New Issue
Block a user