diff --git a/src/components/PhotoFrame.tsx b/src/components/PhotoFrame.tsx index aa49b262e..873aeabbf 100644 --- a/src/components/PhotoFrame.tsx +++ b/src/components/PhotoFrame.tsx @@ -58,7 +58,7 @@ interface Props { ) => void; selected: SelectedState; isFirstLoad?; - hasPersonalFiles?; + hasNoPersonalFiles?; openUploader?; isInSearchMode?: boolean; search?: Search; @@ -80,7 +80,7 @@ const PhotoFrame = ({ setSelected, selected, isFirstLoad, - hasPersonalFiles, + hasNoPersonalFiles, openUploader, isInSearchMode, search, @@ -655,7 +655,7 @@ const PhotoFrame = ({ return ( <> {!isFirstLoad && - !hasPersonalFiles && + hasNoPersonalFiles && !isInSearchMode && activeCollection === ALL_SECTION ? ( diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 3a6a29921..ffec7feae 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -142,7 +142,7 @@ export default function Gallery() { const [isFirstLoad, setIsFirstLoad] = useState(false); const [isFirstFetch, setIsFirstFetch] = useState(false); - const [hasPersonalFiles, setHasPersonalFiles] = useState(false); + const [hasNoPersonalFiles, setHasNoPersonalFiles] = useState(false); const [selected, setSelected] = useState({ ownCount: 0, count: 0, @@ -393,11 +393,10 @@ export default function Gallery() { archivedCollections ); setCollectionSummaries(collectionSummaries); - const incomingShareFiles = files.filter( + const hasNoPersonalFiles = files.every( (file) => file.ownerID !== user.id ); - const hasPersonalFiles = files.length - incomingShareFiles.length > 0; - setHasPersonalFiles(hasPersonalFiles); + setHasNoPersonalFiles(hasNoPersonalFiles); }; const clearSelection = function () { @@ -709,7 +708,7 @@ export default function Gallery() { setSelected={setSelected} selected={selected} isFirstLoad={isFirstLoad} - hasPersonalFiles={hasPersonalFiles} + hasNoPersonalFiles={hasNoPersonalFiles} openUploader={openUploader} isInSearchMode={isInSearchMode} search={search} diff --git a/src/services/collectionService.ts b/src/services/collectionService.ts index c35f33118..b4f627313 100644 --- a/src/services/collectionService.ts +++ b/src/services/collectionService.ts @@ -255,6 +255,7 @@ export const getCollection = async ( }; export const getCollectionLatestFiles = ( + user: User, files: EnteFile[], archivedCollections: Set ): CollectionLatestFiles => { @@ -274,6 +275,7 @@ export const getCollectionLatestFiles = ( !latestFiles.has(ALL_SECTION) && !IsArchived(file) && !file.isTrashed && + file.ownerID === user.id && !archivedCollections.has(file.collectionID) ) { latestFiles.set(ALL_SECTION, file); @@ -943,6 +945,7 @@ export async function getCollectionSummaries( ): Promise { const collectionSummaries: CollectionSummaries = new Map(); const collectionLatestFiles = getCollectionLatestFiles( + user, files, archivedCollections );