diff --git a/CHANGELOG.md b/CHANGELOG.md index 75b18b96..c23196fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - (**Migration**) Fix missing manual search option for in progress entry search without a selected match on mobile - (**Migration**) Fix being unable to retry failed search for a match without a selected match - (**Migration**) Fix selecting a destination from a source browse search page +- (**Migration**) Fix being able to migrate an entry to itself - (**Reader**) Fix scrollbar appearing with "fit to widt/height/screen" page scale mode and applied safe area insets - (**Reader**) Fix wrongly positioned mobile progress bar current page indicator - (**Reader**) Fix mobile progress bar previous/next chapter button visibility on hover and while disabled diff --git a/src/features/global-search/screens/SearchAll.tsx b/src/features/global-search/screens/SearchAll.tsx index ef0b9865..bd34ea28 100644 --- a/src/features/global-search/screens/SearchAll.tsx +++ b/src/features/global-search/screens/SearchAll.tsx @@ -157,7 +157,8 @@ const SourceSearchPreview = React.memo( const { data: searchResult, isLoading, error, abortRequest } = results[0]!; currentAbortRequest.current = abortRequest; - const mangas = searchResult?.fetchSourceManga?.mangas ?? STABLE_EMPTY_ARRAY; + const tmpMangas = searchResult?.fetchSourceManga?.mangas ?? STABLE_EMPTY_ARRAY; + const mangas = tmpMangas.filter((manga) => manga.id !== mangaId); const noMangasFound = !error && !isLoading && !mangas.length; useEffect(() => { diff --git a/src/features/migration/MangaMigration.ts b/src/features/migration/MangaMigration.ts index 37635735..0a90be5a 100644 --- a/src/features/migration/MangaMigration.ts +++ b/src/features/migration/MangaMigration.ts @@ -24,6 +24,8 @@ import { getMetadataServerSettings } from '@/features/settings/services/ServerSe import { Queue } from '@/lib/Queue.ts'; import type { TrackerIdInfo } from '@/features/tracker/Tracker.types.ts'; import { assertIsDefined } from '@/base/Asserts.ts'; +import { t } from '@lingui/core/macro'; +import { makeToast } from '@/base/utils/Toast.ts'; export class MangaMigration { private static trackerQueue = new Map(); @@ -58,6 +60,11 @@ export class MangaMigration { throw new Error('MangaMigration::migrate: missing manga data'); } + if (mangaToMigrate.id === mangaToMigrateTo.id) { + makeToast(t`Can't migrate an entry to itself`, 'error'); + return; + } + if (migrateChapters && !mangaToMigrate.chapters) { throw new Error('MangaMigration::migrate: missing chapters data'); } diff --git a/src/features/migration/MigrationManager.ts b/src/features/migration/MigrationManager.ts index 358ee79b..1895b702 100644 --- a/src/features/migration/MigrationManager.ts +++ b/src/features/migration/MigrationManager.ts @@ -819,7 +819,8 @@ export class MigrationManager { ); const uniqueSearchResults = uniqBy('id', searchResults); const matches = uniqueSearchResults.filter( - (searchMatch) => enhancedCleanup(searchMatch.title) === enhancedCleanup(mangaTitle), + (searchMatch) => + searchMatch.id !== mangaId && enhancedCleanup(searchMatch.title) === enhancedCleanup(mangaTitle), ); const matchUpdatePromises = matches.map(async (match) => { diff --git a/src/features/source/browse/screens/SourceMangas.tsx b/src/features/source/browse/screens/SourceMangas.tsx index 0e130e03..3bf239f8 100644 --- a/src/features/source/browse/screens/SourceMangas.tsx +++ b/src/features/source/browse/screens/SourceMangas.tsx @@ -108,6 +108,7 @@ const useSourceManga = ( filters: IPos[], initialPages: number, hideLibraryEntries: boolean, + mangaId?: MangaIdInfo['id'], ): [ AbortableApolloUseMutationPaginatedResponse[0], AbortableApolloUseMutationPaginatedResponse< @@ -168,7 +169,9 @@ const useSourceManga = ( pages.forEach((page, index) => { const pageItems = page.data?.fetchSourceManga?.mangas ?? []; - const nonLibraryPageItems = pageItems.filter((item) => !hideLibraryEntries || !item.inLibrary); + const nonLibraryPageItems = pageItems.filter( + (item) => item.id !== mangaId && (!hideLibraryEntries || !item.inLibrary), + ); const uniqueItems = getUniqueMangas([...allItems, ...nonLibraryPageItems]); const isLastPage = !isPageLoading && pages.length === index + 1; @@ -287,7 +290,7 @@ export function SourceMangas() { const [ loadPage, { data, error, isLoading: loading, size: lastPageNum, abortRequest, filteredOutAllItemsOfFetchedPage }, - ] = useSourceManga(sourceId, contentType, query, filtersToApply, 1, hideLibraryEntries); + ] = useSourceManga(sourceId, contentType, query, filtersToApply, 1, hideLibraryEntries, mangaId); currentAbortRequest.current = abortRequest; const mangas = data?.fetchSourceManga?.mangas ?? STABLE_EMPTY_ARRAY; const hasNextPage = !!data?.fetchSourceManga?.hasNextPage;