Skip to content

armgit / ente

Public Imported from GitHub
0

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

Inline

Manav Rathi3213735a4d5d
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index 73267f1a30..aa75cba123 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -1372,11 +1372,11 @@ const createCollectionSummaries = (
let type: CollectionSummaryType;
if (collection.owner.id != user.id) {
- if (isIncomingCollabShare(collection, user)) {
- type = "incomingShareCollaborator";
- } else {
- type = "incomingShareViewer";
- }
+ type =
+ collection.sharees.find((s) => s.id == user.id)?.role ==
+ "COLLABORATOR"
+ ? "incomingShareCollaborator"
+ : "incomingShareViewer";
} else if (collectionType == "favorites") {
// [Note: User and shared favorites]
//
@@ -1415,11 +1415,12 @@ const createCollectionSummaries = (
// until type is completely replaced by attributes.
const attributes: CollectionSummaryType[] = [];
if (collection.owner.id != user.id) {
- if (isIncomingCollabShare(collection, user)) {
- attributes.push("incomingShareCollaborator");
- } else {
- attributes.push("incomingShareViewer");
- }
+ attributes.push(
+ collection.sharees.find((s) => s.id == user.id)?.role ==
+ "COLLABORATOR"
+ ? "incomingShareCollaborator"
+ : "incomingShareViewer",
+ );
}
if (isOutgoingShare(collection, user)) {
attributes.push("outgoingShare");
@@ -1521,13 +1522,6 @@ const findCoverFiles = (
return coverFiles;
};
-const isIncomingCollabShare = (collection: Collection, user: User) => {
- // TODO: Need to audit the types
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
- const sharee = collection.sharees?.find((sharee) => sharee.id === user.id);
- return sharee?.role == "COLLABORATOR";
-};
-
const isOutgoingShare = (collection: Collection, user: User) =>
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
collection.owner.id === user.id && collection.sharees?.length > 0;