Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Don't show delete in shared

Manav Rathi189728538028
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index a60768019a..c1e5460f4d 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -146,6 +146,7 @@ export type PhotoFrameProps = Pick<
enableDownload?: boolean;
showAppDownloadBanner?: boolean;
setIsPhotoSwipeOpen?: (value: boolean) => void;
+ isInIncomingSharedCollection?: boolean;
isInHiddenSection?: boolean;
setFilesDownloadProgressAttributesCreator?: SetFilesDownloadProgressAttributesCreator;
selectable?: boolean;
@@ -171,6 +172,7 @@ const PhotoFrame = ({
allCollectionsNameByID,
showAppDownloadBanner,
setIsPhotoSwipeOpen,
+ isInIncomingSharedCollection,
isInHiddenSection,
setFilesDownloadProgressAttributesCreator,
selectable,
@@ -589,8 +591,9 @@ const PhotoFrame = ({
files={files}
initialIndex={currentIndex}
disableDownload={!enableDownload}
- isInHiddenSection={isInHiddenSection}
+ isInIncomingSharedCollection={isInIncomingSharedCollection}
isInTrashSection={activeCollectionID === TRASH_SECTION}
+ isInHiddenSection={isInHiddenSection}
onTriggerSyncWithRemote={handleTriggerSyncWithRemote}
onToggleFavorite={handleToggleFavorite}
onDownload={handleDownload}
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 3fed596013..b57b6e312c 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1071,6 +1071,12 @@ const Page: React.FC = () => {
showAppDownloadBanner={
files.length < 30 && !isInSearchMode
}
+ isInIncomingSharedCollection={
+ collectionSummaries.get(activeCollectionID)
+ ?.type == "incomingShareCollaborator" ||
+ collectionSummaries.get(activeCollectionID)
+ ?.type == "incomingShareViewer"
+ }
isInHiddenSection={barMode == "hidden-albums"}
setFilesDownloadProgressAttributesCreator={
setFilesDownloadProgressAttributesCreator
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index a16954be66..4aae85fe0c 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -152,6 +152,10 @@ export type FileViewerProps = ModalVisibilityProps & {
* If true then the viewer does not show controls for downloading the file.
*/
disableDownload?: boolean;
+ /**
+ * `true` when we are viewing files in an album that the user does not own.
+ */
+ isInIncomingSharedCollection?: boolean;
/**
* `true` when we are viewing files in the Trash.
*/
@@ -238,6 +242,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
files,
initialIndex,
disableDownload,
+ isInIncomingSharedCollection,
isInTrashSection,
isInHiddenSection,
favoriteFileIDs,
@@ -477,9 +482,15 @@ const FileViewer: React.FC<FileViewerProps> = ({
const canModify =
isOwnFile && !isInTrashSection && !isInHiddenSection;
+
const showFavorite = canModify;
+
const showDelete =
- !!handleConfirmDelete && isOwnFile && !isInTrashSection;
+ !!handleConfirmDelete &&
+ isOwnFile &&
+ !isInTrashSection &&
+ !isInIncomingSharedCollection;
+
const showEditImage =
!!handleEditImage && canModify && fileIsEditableImage(file);
@@ -526,6 +537,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
[
user,
disableDownload,
+ isInIncomingSharedCollection,
isInTrashSection,
isInHiddenSection,
onDownload,