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

View file

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

View file

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

View file

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

View file

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

View file

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