Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][contacts] fix local lint regressions

Neeraj Gupta3d7da38bfac6
diff --git a/web/apps/locker/src/components/LockerCollectionShareDrawer.tsx b/web/apps/locker/src/components/LockerCollectionShareDrawer.tsx
index 6c28d32be4..36730f181e 100644
--- a/web/apps/locker/src/components/LockerCollectionShareDrawer.tsx
+++ b/web/apps/locker/src/components/LockerCollectionShareDrawer.tsx
@@ -14,21 +14,21 @@ import {
TextField,
Typography,
} from "@mui/material";
-import { masterKeyFromSession } from "ente-accounts-rs/services/session-storage";
import { savedLocalUser } from "ente-accounts-rs/services/accounts-db";
+import { masterKeyFromSession } from "ente-accounts-rs/services/session-storage";
import {
OverflowMenu,
OverflowMenuOption,
} from "ente-base/components/OverflowMenu";
import { SidebarDrawer } from "ente-base/components/mui/SidebarDrawer";
import { useBaseContext } from "ente-base/context";
+import { isHTTPErrorWithStatus } from "ente-base/http";
+import log from "ente-base/log";
import {
ensureContactsReady,
useResolvedContactAvatar,
useResolvedContactDisplay,
} from "ente-contacts-web";
-import { isHTTPErrorWithStatus } from "ente-base/http";
-import log from "ente-base/log";
import { t } from "i18next";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import {
@@ -138,11 +138,10 @@ export const LockerCollectionShareDrawer: React.FC<
return;
}
- let cancelled = false;
void (async () => {
try {
const masterKeyB64 = await masterKeyFromSession();
- if (!masterKeyB64 || cancelled) {
+ if (!masterKeyB64) {
return;
}
await ensureContactsReady({
@@ -150,18 +149,12 @@ export const LockerCollectionShareDrawer: React.FC<
masterKeyB64,
});
} catch (error) {
- if (!cancelled) {
- log.warn(
- "[LockerCollectionShareDrawer] Failed to warm contacts display cache",
- error,
- );
- }
+ log.warn(
+ "[LockerCollectionShareDrawer] Failed to warm contacts display cache",
+ error,
+ );
}
})();
-
- return () => {
- cancelled = true;
- };
}, [currentUser.id, open]);
const sortedSharees = useMemo(
@@ -566,7 +559,7 @@ const ParticipantRow: React.FC<{
const initial =
resolved.source === "contact"
? resolved.initial
- : (email.charAt(0).toUpperCase() || "?");
+ : email.charAt(0).toUpperCase() || "?";
return (
<Stack
diff --git a/web/apps/locker/src/components/lockerPage/useLockerData.ts b/web/apps/locker/src/components/lockerPage/useLockerData.ts
index 16bcfeff64..8dbdc609fd 100644
--- a/web/apps/locker/src/components/lockerPage/useLockerData.ts
+++ b/web/apps/locker/src/components/lockerPage/useLockerData.ts
@@ -12,10 +12,10 @@ import {
ensureOk,
isHTTP401Error,
} from "ente-base/http";
-import { ensureContactsReady } from "ente-contacts-web";
import log from "ente-base/log";
import { apiURL } from "ente-base/origins";
import { savedAuthToken } from "ente-base/token";
+import { ensureContactsReady } from "ente-contacts-web";
import { t } from "i18next";
import type { NextRouter } from "next/router";
import { useCallback, useEffect, useRef, useState } from "react";
diff --git a/web/apps/photos/src/components/Avatar.tsx b/web/apps/photos/src/components/Avatar.tsx
index 8b46c50659..4662428353 100644
--- a/web/apps/photos/src/components/Avatar.tsx
+++ b/web/apps/photos/src/components/Avatar.tsx
@@ -1,5 +1,4 @@
// TODO: Audit this file
-/* eslint-disable react-hooks/exhaustive-deps */
import { styled } from "@mui/material";
import type { LocalUser } from "ente-accounts/services/user";
import { useResolvedContactAvatar } from "ente-contacts-web";
@@ -49,8 +48,13 @@ const AvatarImage = styled("img")<{
opacity === undefined ? 1 : Math.max(0, Math.min(opacity, 100)) / 100};
`;
-const colorSeedFromEmail = (email: string) =>
- [...email].reduce((acc, char) => acc + char.charCodeAt(0), 0);
+const colorSeedFromEmail = (email: string) => {
+ let seed = 0;
+ for (const char of email) {
+ seed += char.codePointAt(0) ?? 0;
+ }
+ return seed;
+};
const Avatar: React.FC<AvatarProps> = ({
user,
@@ -65,13 +69,8 @@ const Avatar: React.FC<AvatarProps> = ({
const resolvedContact = useResolvedContactAvatar(
file && file.ownerID !== user?.id
- ? {
- userID: file.ownerID,
- email: emailByUserID?.get(file.ownerID),
- }
- : {
- email,
- },
+ ? { userID: file.ownerID, email: emailByUserID?.get(file.ownerID) }
+ : { email },
);
const fallbackEmail = resolvedContact.actualEmail ?? email;
@@ -114,7 +113,13 @@ const Avatar: React.FC<AvatarProps> = ({
]);
if (resolvedContact.avatarURL && !isPublicCollectedAvatar) {
- return <AvatarImage size={18} opacity={opacity} src={resolvedContact.avatarURL} />;
+ return (
+ <AvatarImage
+ size={18}
+ opacity={opacity}
+ src={resolvedContact.avatarURL}
+ />
+ );
}
if (!colorCode || !userLetter) {
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index 78d0a2ebc5..6b348e5c13 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -21,7 +21,6 @@ import TextField from "@mui/material/TextField";
import Avatar from "components/Avatar";
import { type LocalUser } from "ente-accounts/services/user";
import { LoadingButton } from "ente-base/components/mui/LoadingButton";
-import { useResolvedContactDisplay } from "ente-contacts-web";
import {
SidebarDrawer,
SidebarDrawerTitlebar,
@@ -51,6 +50,7 @@ import { deriveInteractiveKey } from "ente-base/crypto";
import { isHTTPErrorWithStatus, isMuseumHTTPError } from "ente-base/http";
import { formattedDateTime } from "ente-base/i18n-date";
import log from "ente-base/log";
+import { useResolvedContactDisplay } from "ente-contacts-web";
import { appendCollectionKeyToShareURL } from "ente-gallery/services/share";
import type {
Collection,
@@ -301,10 +301,7 @@ export const CollectionShare: React.FC<CollectionShareProps> = ({
type ResolvedEmailRowCommonProps = Pick<
CollectionShareProps,
"user" | "emailByUserID"
-> & {
- email?: string;
- fallbackLabel?: string;
-};
+> & { email?: string; fallbackLabel?: string };
const ResolvedEmailRowLabel: React.FC<ResolvedEmailRowCommonProps> = ({
email,
@@ -428,18 +425,18 @@ const SharingDetails: React.FC<SharingDetailsProps> = ({
<RowButtonGroupTitle icon={<AdminPanelSettingsIcon />}>
{t("admins", { defaultValue: "Admins" })}
</RowButtonGroupTitle>
- <RowButtonGroup>
- {admins.map((email, index) => (
- <React.Fragment key={email}>
- <ResolvedEmailRowLabel
- email={email}
- fallbackLabel={
- email == user.email
- ? t("you")
- : undefined
- }
- {...{ user, emailByUserID }}
- />
+ <RowButtonGroup>
+ {admins.map((email, index) => (
+ <React.Fragment key={email}>
+ <ResolvedEmailRowLabel
+ email={email}
+ fallbackLabel={
+ email == user.email
+ ? t("you")
+ : undefined
+ }
+ {...{ user, emailByUserID }}
+ />
{index != admins.length - 1 && (
<RowButtonDivider />
)}
@@ -479,21 +476,21 @@ const SharingDetails: React.FC<SharingDetailsProps> = ({
<RowButtonGroupTitle icon={<Photo />}>
{t("viewers")}
</RowButtonGroupTitle>
- <RowButtonGroup>
- {viewers.map((email, index) => (
- <React.Fragment key={email}>
- <ResolvedEmailRowLabel
- email={email}
- fallbackLabel={
- email == user.email
- ? t("you")
- : undefined
- }
- {...{ user, emailByUserID }}
- />
- {index != viewers.length - 1 && (
- <RowButtonDivider />
- )}
+ <RowButtonGroup>
+ {viewers.map((email, index) => (
+ <React.Fragment key={email}>
+ <ResolvedEmailRowLabel
+ email={email}
+ fallbackLabel={
+ email == user.email
+ ? t("you")
+ : undefined
+ }
+ {...{ user, emailByUserID }}
+ />
+ {index != viewers.length - 1 && (
+ <RowButtonDivider />
+ )}
</React.Fragment>
))}
</RowButtonGroup>
@@ -575,16 +572,11 @@ const EmailShare: React.FC<EmailShareProps> = ({
/>
}
label={
- collection.sharees.length === 1
- ? (
- <ResolvedEmailText
- email={
- collection.sharees[0]
- ?.email
- }
- />
- )
- : null
+ collection.sharees.length === 1 ? (
+ <ResolvedEmailText
+ email={collection.sharees[0]?.email}
+ />
+ ) : null
}
endIcon={<ChevronRightIcon />}
onClick={showManageEmail}
@@ -1081,14 +1073,14 @@ const ManageEmailShare: React.FC<ManageEmailShareProps> = ({
<RowButtonGroupTitle icon={<AdminPanelSettingsIcon />}>
{t("owner")}
</RowButtonGroupTitle>
- <RowButtonGroup>
- <ResolvedEmailRowLabel
- email={ownerEmail}
- fallbackLabel={isOwner ? t("you") : undefined}
- {...{ user, emailByUserID }}
- />
- </RowButtonGroup>
- </Stack>
+ <RowButtonGroup>
+ <ResolvedEmailRowLabel
+ email={ownerEmail}
+ fallbackLabel={isOwner ? t("you") : undefined}
+ {...{ user, emailByUserID }}
+ />
+ </RowButtonGroup>
+ </Stack>
{(admins.length > 0 || canManageParticipants) && (
<Stack>
<RowButtonGroupTitle
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 6c7054fb0e..cdcdfce5fd 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -49,9 +49,9 @@ import {
haveMasterKeyInSession,
masterKeyFromSession,
} from "ente-base/session";
-import { ensureContactsReady } from "ente-contacts-web";
import { savedAuthToken } from "ente-base/token";
import type { Location } from "ente-base/types";
+import { ensureContactsReady } from "ente-contacts-web";
import { FullScreenDropZone } from "ente-gallery/components/FullScreenDropZone";
import { type UploadTypeSelectorIntent } from "ente-gallery/components/Upload";
import { useSaveGroups } from "ente-gallery/components/utils/save-groups";
diff --git a/web/packages/contacts/db.ts b/web/packages/contacts/db.ts
index 963a1e6353..e765cba0fe 100644
--- a/web/packages/contacts/db.ts
+++ b/web/packages/contacts/db.ts
@@ -5,7 +5,8 @@ import type { ContactDisplayRecord, WrappedRootContactKey } from "./types";
const contactsKey = (sessionKey: string) => `contacts/${sessionKey}/records`;
const wrappedRootKeyKey = (sessionKey: string) =>
`contacts/${sessionKey}/root-key`;
-const sinceTimeKey = (sessionKey: string) => `contacts/${sessionKey}/since-time`;
+const sinceTimeKey = (sessionKey: string) =>
+ `contacts/${sessionKey}/since-time`;
const ContactDisplayRecordZ = z.object({
contactId: z.string(),
diff --git a/web/packages/contacts/index.test.ts b/web/packages/contacts/index.test.ts
index e087ae3999..5c5abcdc83 100644
--- a/web/packages/contacts/index.test.ts
+++ b/web/packages/contacts/index.test.ts
@@ -98,19 +98,17 @@ const setupContactsModule = async (options: SetupOptions = {}) => {
header: "wrapped-header",
}));
- const diff =
- options.diff ??
- [
- {
- id: "ct_1",
- contactUserId: 101,
- email: "[email protected]",
- name: "Set",
- profilePictureAttachmentID: "ua_1",
- isDeleted: false,
- updatedAt: 1,
- },
- ];
+ const diff = options.diff ?? [
+ {
+ id: "ct_1",
+ contactUserId: 101,
+ email: "[email protected]",
+ name: "Set",
+ profilePictureAttachmentID: "ua_1",
+ isDeleted: false,
+ updatedAt: 1,
+ },
+ ];
const get_diff = vi
.fn()
@@ -123,20 +121,10 @@ const setupContactsModule = async (options: SetupOptions = {}) => {
throw options.getProfilePictureError ?? new Error("boom");
});
- vi.doMock("ente-base/kv", () => ({
- getKV,
- getKVN,
- setKV,
- }));
- vi.doMock("ente-base/token", () => ({
- savedAuthToken,
- }));
- vi.doMock("ente-base/origins", () => ({
- apiOrigin,
- }));
- vi.doMock("ente-base/log", () => ({
- default: { info, warn, error },
- }));
+ vi.doMock("ente-base/kv", () => ({ getKV, getKVN, setKV }));
+ vi.doMock("ente-base/token", () => ({ savedAuthToken }));
+ vi.doMock("ente-base/origins", () => ({ apiOrigin }));
+ vi.doMock("ente-base/log", () => ({ default: { info, warn, error } }));
vi.doMock("ente-base/app", () => ({
clientPackageName: "io.ente.photos.web",
desktopAppVersion: undefined,
@@ -153,13 +141,7 @@ const setupContactsModule = async (options: SetupOptions = {}) => {
const contacts = await import("./index");
- return {
- contacts,
- setKV,
- get_diff,
- get_profile_picture,
- info,
- };
+ return { contacts, setKV, get_diff, get_profile_picture, info };
};
describe("ensureContactsReady", () => {
@@ -216,13 +198,10 @@ describe("profile picture loading", () => {
test("uses the inferred image mime type for avatar blobs", async () => {
const createObjectURL = vi.fn((_blob: Blob) => "blob:contact");
- vi.stubGlobal("URL", {
- createObjectURL,
- revokeObjectURL: vi.fn(),
- });
+ vi.stubGlobal("URL", { createObjectURL, revokeObjectURL: vi.fn() });
const pngBytes = Uint8Array.from([
- 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
- 0x00, 0x00, 0x00, 0x0d,
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00,
+ 0x0d,
]);
const { contacts } = await setupContactsModule({
getProfilePictureBytes: pngBytes,
@@ -232,9 +211,7 @@ describe("profile picture loading", () => {
userID: 101,
masterKeyB64: "ignored",
});
- await contacts.__testing.preloadResolvedContactAvatar({
- userID: 101,
- });
+ await contacts.__testing.preloadResolvedContactAvatar({ userID: 101 });
const blobArg = createObjectURL.mock.calls[0]?.[0] as Blob | undefined;
expect(blobArg?.type).toBe("image/png");
diff --git a/web/packages/contacts/index.ts b/web/packages/contacts/index.ts
index 8b34cdaf81..4c431ea8b1 100644
--- a/web/packages/contacts/index.ts
+++ b/web/packages/contacts/index.ts
@@ -1,16 +1,9 @@
-import { useCallback, useEffect, useMemo, useSyncExternalStore } from "react";
-import {
- clientPackageName,
- desktopAppVersion,
- isDesktop,
-} from "ente-base/app";
+import { clientPackageName, desktopAppVersion, isDesktop } from "ente-base/app";
import log from "ente-base/log";
import { apiOrigin } from "ente-base/origins";
import { savedAuthToken } from "ente-base/token";
-import {
- contacts_open_ctx,
- type ContactsCtxHandle,
-} from "ente-wasm";
+import { contacts_open_ctx, type ContactsCtxHandle } from "ente-wasm";
+import { useCallback, useEffect, useMemo, useSyncExternalStore } from "react";
import {
saveContactDisplayRecords,
saveContactsSinceTime,
@@ -49,10 +42,7 @@ type RemoteContactRecord = {
updatedAt: number | bigint;
};
-type ContactsReadyInput = {
- userID: number;
- masterKeyB64: string;
-};
+type ContactsReadyInput = { userID: number; masterKeyB64: string };
type ContactsState = {
snapshot: ContactsDisplaySnapshot;
@@ -229,11 +219,9 @@ const contactDisplayRecordFromRemote = (
contactUserId: Number(record.contactUserId),
resolvedEmail: knownEmailOrUndefined(record.email),
displayName: knownEmailOrUndefined(record.name),
- profilePictureAttachmentID:
- knownEmailOrUndefined(
- record.profilePictureAttachmentID ??
- record.profilePictureAttachmentId,
- ),
+ profilePictureAttachmentID: knownEmailOrUndefined(
+ record.profilePictureAttachmentID ?? record.profilePictureAttachmentId,
+ ),
updatedAt: Number(record.updatedAt),
});
@@ -254,7 +242,8 @@ export const contactsDisplaySubscribe = (onChange: () => void) => {
const subscribeAvatarURL = (contactID: string, onChange: () => void) => {
const listeners =
- state.avatarListenersByContactID.get(contactID) ?? new Set<() => void>();
+ state.avatarListenersByContactID.get(contactID) ??
+ new Set<() => void>();
listeners.add(onChange);
state.avatarListenersByContactID.set(contactID, listeners);
return () => {
@@ -374,10 +363,9 @@ const syncContacts = async ({
if (!isCurrentSession(sessionKey, generation)) {
return;
}
- await saveContactDisplayRecords(
- sessionKey,
- [...state.contactsByID.values()],
- );
+ await saveContactDisplayRecords(sessionKey, [
+ ...state.contactsByID.values(),
+ ]);
await saveContactsSinceTime(sessionKey, sinceTime);
emitSnapshot(true);
}
@@ -468,7 +456,12 @@ const inferImageMimeType = (bytes: Uint8Array) => {
) {
return "image/png";
}
- if (bytes.length >= 3 && bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff) {
+ if (
+ bytes.length >= 3 &&
+ bytes[0] === 0xff &&
+ bytes[1] === 0xd8 &&
+ bytes[2] === 0xff
+ ) {
return "image/jpeg";
}
if (
@@ -510,12 +503,13 @@ const ensureProfilePictureLoaded = async (contactID: string) => {
const load = ctx
.get_profile_picture(contactID)
.then((bytes: Uint8Array) => {
- if (!isCurrentSession(sessionKey, generation) || state.ctx !== ctx) {
+ if (
+ !isCurrentSession(sessionKey, generation) ||
+ state.ctx !== ctx
+ ) {
return;
}
- const blob = new Blob([bytes], {
- type: inferImageMimeType(bytes),
- });
+ const blob = new Blob([bytes], { type: inferImageMimeType(bytes) });
const url = URL.createObjectURL(blob);
cleanupAvatarURL(contactID);
state.avatarURLByContactID.set(contactID, url);
@@ -523,7 +517,10 @@ const ensureProfilePictureLoaded = async (contactID: string) => {
emitAvatarURL(contactID);
})
.catch((error: unknown) => {
- if (!isCurrentSession(sessionKey, generation) || state.ctx !== ctx) {
+ if (
+ !isCurrentSession(sessionKey, generation) ||
+ state.ctx !== ctx
+ ) {
return;
}
state.avatarFailureUntilByContactID.set(
@@ -590,8 +587,5 @@ export const useResolvedContactAvatar = (
void ensureProfilePictureLoaded(display.contactId);
}, [display.contactId, display.profilePictureAttachmentID]);
- return {
- ...display,
- avatarURL,
- };
+ return { ...display, avatarURL };
};
diff --git a/web/packages/contacts/package.json b/web/packages/contacts/package.json
index 5dc682f1c3..685c2bcc73 100644
--- a/web/packages/contacts/package.json
+++ b/web/packages/contacts/package.json
@@ -4,6 +4,9 @@
"private": true,
"main": "./index.ts",
"types": "./index.ts",
+ "scripts": {
+ "test": "vitest"
+ },
"dependencies": {
"ente-base": "*",
"ente-wasm": "*",
@@ -14,8 +17,5 @@
"@types/react": "^19.2.2",
"ente-build-config": "*",
"vitest": "^3.2.4"
- },
- "scripts": {
- "test": "vitest"
}
}
diff --git a/web/packages/contacts/resolver.ts b/web/packages/contacts/resolver.ts
index a11e4164ca..6cc216cfe0 100644
--- a/web/packages/contacts/resolver.ts
+++ b/web/packages/contacts/resolver.ts
@@ -4,7 +4,8 @@ import type {
ResolvedContactDisplay,
} from "./types";
-export const normalizeEmail = (email?: string | null) => email?.trim().toLowerCase();
+export const normalizeEmail = (email?: string | null) =>
+ email?.trim().toLowerCase();
export const knownEmailOrUndefined = (email?: string | null) => {
const trimmed = email?.trim();
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index 633ff8cdba..95c4fd6dea 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -12,12 +12,12 @@ import {
TextField,
Typography,
} from "@mui/material";
+import { type ModalVisibilityProps } from "ente-base/components/utils/modal";
+import log from "ente-base/log";
import {
useResolvedContactAvatar,
useResolvedContactDisplay,
} from "ente-contacts-web";
-import { type ModalVisibilityProps } from "ente-base/components/utils/modal";
-import log from "ente-base/log";
import { downloadManager } from "ente-gallery/services/download";
import { getAvatarColor } from "ente-gallery/utils/avatar-colors";
import type { EnteFile } from "ente-media/file";
@@ -252,8 +252,9 @@ const CommentHeader: React.FC<CommentHeaderProps> = ({
userID: useContactDisplay ? userID : undefined,
email: useContactDisplay ? email : undefined,
});
- const displayName =
- useContactDisplay ? (resolved.primaryLabel || userName) : userName;
+ const displayName = useContactDisplay
+ ? resolved.primaryLabel || userName
+ : userName;
return (
<CommentHeaderContainer>
@@ -262,17 +263,19 @@ const CommentHeader: React.FC<CommentHeaderProps> = ({
width: avatarSize,
height: avatarSize,
fontSize: 14,
- bgcolor: getAvatarColor(avatarColorKey ?? email ?? userName),
+ bgcolor: getAvatarColor(
+ avatarColorKey ?? email ?? userName,
+ ),
color: "#fff",
}}
src={useContactDisplay ? resolved.avatarURL : undefined}
>
{isMaskedEmail ? (
<PersonIcon />
+ ) : useContactDisplay ? (
+ resolved.initial
) : (
- (useContactDisplay
- ? resolved.initial
- : userName[0]?.toUpperCase())
+ userName[0]?.toUpperCase()
)}
</Avatar>
<UserName>{displayName}</UserName>
@@ -337,7 +340,7 @@ const QuotedReply: React.FC<QuotedReplyProps> = ({
// For registered users, look up email
return shouldResolveParent
- ? (resolvedParent.primaryLabel || parentEmail || t("user"))
+ ? resolvedParent.primaryLabel || parentEmail || t("user")
: (parentEmail ?? t("user"));
};
diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsx
index 07f08305eb..f29dc947a6 100644
--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx
+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx
@@ -9,9 +9,9 @@ import {
styled,
Typography,
} from "@mui/material";
-import { useResolvedContactAvatar } from "ente-contacts-web";
import { type ModalVisibilityProps } from "ente-base/components/utils/modal";
import log from "ente-base/log";
+import { useResolvedContactAvatar } from "ente-contacts-web";
import { downloadManager } from "ente-gallery/services/download";
import { getAvatarColor } from "ente-gallery/utils/avatar-colors";
import type { EnteFile } from "ente-media/file";
@@ -126,15 +126,15 @@ const LikerRowItem: React.FC<{ liker: Liker }> = ({ liker }) => {
>
{liker.isMaskedEmail ? (
<PersonIcon />
+ ) : shouldResolveContact ? (
+ resolved.initial
) : (
- (shouldResolveContact
- ? resolved.initial
- : liker.avatarInitial)
+ liker.avatarInitial
)}
</Avatar>
<LikerName>
{shouldResolveContact
- ? (resolved.primaryLabel || liker.userName)
+ ? resolved.primaryLabel || liker.userName
: liker.userName}
</LikerName>
<HeartFilledIcon />