Changed isSharedCollection check name to isIncomingSharedCollection

This commit is contained in:
Ananddubey01 2023-02-02 22:49:27 +05:30
parent 98e3186d44
commit f9b46e11d7
6 changed files with 22 additions and 15 deletions

View file

@ -66,7 +66,7 @@ interface Props {
deletedFileIds?: Set<number>; deletedFileIds?: Set<number>;
setDeletedFileIds?: (value: Set<number>) => void; setDeletedFileIds?: (value: Set<number>) => void;
activeCollection: number; activeCollection: number;
isSharedCollection?: boolean; isIncomingSharedCollection?: boolean;
enableDownload?: boolean; enableDownload?: boolean;
isDeduplicating?: boolean; isDeduplicating?: boolean;
resetSearch?: () => void; resetSearch?: () => void;
@ -95,7 +95,7 @@ const PhotoFrame = ({
deletedFileIds, deletedFileIds,
setDeletedFileIds, setDeletedFileIds,
activeCollection, activeCollection,
isSharedCollection, isIncomingSharedCollection,
enableDownload, enableDownload,
isDeduplicating, isDeduplicating,
}: Props) => { }: Props) => {
@ -179,7 +179,10 @@ const PhotoFrame = ({
return false; return false;
} }
if (isSharedFile(user, item) && !isSharedCollection) { if (
isSharedFile(user, item) &&
!isIncomingSharedCollection
) {
return false; return false;
} }
if (activeCollection === TRASH_SECTION && !item.isTrashed) { if (activeCollection === TRASH_SECTION && !item.isTrashed) {
@ -499,7 +502,7 @@ const PhotoFrame = ({
file={files[index]} file={files[index]}
updateURL={updateURL(files[index].id)} updateURL={updateURL(files[index].id)}
onClick={onThumbnailClick(index)} onClick={onThumbnailClick(index)}
selectable={!isSharedCollection} selectable={!isIncomingSharedCollection}
onSelect={handleSelect(files[index].id, index)} onSelect={handleSelect(files[index].id, index)}
selected={ selected={
selected.collectionID === activeCollection && selected.collectionID === activeCollection &&
@ -714,7 +717,7 @@ const PhotoFrame = ({
favItemIds={favItemIds} favItemIds={favItemIds}
deletedFileIds={deletedFileIds} deletedFileIds={deletedFileIds}
setDeletedFileIds={setDeletedFileIds} setDeletedFileIds={setDeletedFileIds}
isSharedCollection={isSharedCollection} isIncomingSharedCollection={isIncomingSharedCollection}
isTrashCollection={activeCollection === TRASH_SECTION} isTrashCollection={activeCollection === TRASH_SECTION}
enableDownload={enableDownload} enableDownload={enableDownload}
isSourceLoaded={isSourceLoaded} isSourceLoaded={isSourceLoaded}

View file

@ -68,7 +68,7 @@ interface Iprops {
favItemIds: Set<number>; favItemIds: Set<number>;
deletedFileIds: Set<number>; deletedFileIds: Set<number>;
setDeletedFileIds?: (value: Set<number>) => void; setDeletedFileIds?: (value: Set<number>) => void;
isSharedCollection: boolean; isIncomingSharedCollection: boolean;
isTrashCollection: boolean; isTrashCollection: boolean;
enableDownload: boolean; enableDownload: boolean;
isSourceLoaded: boolean; isSourceLoaded: boolean;
@ -393,7 +393,11 @@ function PhotoViewer(props: Iprops) {
}; };
const confirmTrashFile = (file: EnteFile) => { const confirmTrashFile = (file: EnteFile) => {
if (!file || props.isSharedCollection || props.isTrashCollection) { if (
!file ||
props.isIncomingSharedCollection ||
props.isTrashCollection
) {
return; return;
} }
appContext.setDialogMessage(getTrashFileMessage(() => trashFile(file))); appContext.setDialogMessage(getTrashFileMessage(() => trashFile(file)));
@ -571,7 +575,7 @@ function PhotoViewer(props: Iprops) {
<ContentCopy fontSize="small" /> <ContentCopy fontSize="small" />
</button> </button>
)} )}
{!props.isSharedCollection && {!props.isIncomingSharedCollection &&
!props.isTrashCollection && ( !props.isTrashCollection && (
<button <button
className="pswp__button pswp__button--custom" className="pswp__button pswp__button--custom"
@ -593,7 +597,7 @@ function PhotoViewer(props: Iprops) {
title={constants.TOGGLE_FULLSCREEN} title={constants.TOGGLE_FULLSCREEN}
/> />
{!props.isSharedCollection && ( {!props.isIncomingSharedCollection && (
<button <button
className="pswp__button pswp__button--custom" className="pswp__button pswp__button--custom"
title={constants.INFO_OPTION} title={constants.INFO_OPTION}
@ -601,7 +605,7 @@ function PhotoViewer(props: Iprops) {
<InfoIcon fontSize="small" /> <InfoIcon fontSize="small" />
</button> </button>
)} )}
{!props.isSharedCollection && {!props.isIncomingSharedCollection &&
!props.isTrashCollection && ( !props.isTrashCollection && (
<button <button
title={ title={
@ -652,7 +656,7 @@ function PhotoViewer(props: Iprops) {
</div> </div>
<FileInfo <FileInfo
isTrashCollection={props.isTrashCollection} isTrashCollection={props.isTrashCollection}
shouldDisableEdits={props.isSharedCollection} shouldDisableEdits={props.isIncomingSharedCollection}
showInfo={showInfo} showInfo={showInfo}
handleCloseInfo={handleCloseInfo} handleCloseInfo={handleCloseInfo}
file={photoSwipe?.currItem as EnteFile} file={photoSwipe?.currItem as EnteFile}

View file

@ -727,7 +727,7 @@ export default function Gallery() {
deletedFileIds={deletedFileIds} deletedFileIds={deletedFileIds}
setDeletedFileIds={setDeletedFileIds} setDeletedFileIds={setDeletedFileIds}
activeCollection={activeCollection} activeCollection={activeCollection}
isSharedCollection={ isIncomingSharedCollection={
collectionSummaries[activeCollection] === collectionSummaries[activeCollection] ===
CollectionSummaryType.incomingShare CollectionSummaryType.incomingShare
} }

View file

@ -410,7 +410,7 @@ export default function PublicCollectionGallery() {
selected={{ count: 0, collectionID: null }} selected={{ count: 0, collectionID: null }}
isFirstLoad={true} isFirstLoad={true}
activeCollection={ALL_SECTION} activeCollection={ALL_SECTION}
isSharedCollection isIncomingSharedCollection
enableDownload={ enableDownload={
publicCollection?.publicURLs?.[0]?.enableDownload ?? publicCollection?.publicURLs?.[0]?.enableDownload ??
true true

View file

@ -37,7 +37,7 @@ export interface Collection
> { > {
key: string; key: string;
name: string; name: string;
isSharedCollection?: boolean; isIncomingSharedCollection?: boolean;
magicMetadata: CollectionMagicMetadata; magicMetadata: CollectionMagicMetadata;
} }

View file

@ -77,7 +77,7 @@ export function getSelectedCollection(
return collections.find((collection) => collection.id === collectionID); return collections.find((collection) => collection.id === collectionID);
} }
export function isSharedCollection( export function isIncomingSharedCollection(
collectionID: number, collectionID: number,
collections: Collection[] collections: Collection[]
) { ) {