Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rename

Manav Rathief4b9ebc42e1
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index 9e799df3ca..aa586955ab 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -102,8 +102,8 @@ import {
isSubscriptionPastDue,
isSubscriptionStripe,
leaveFamily,
+ pullUserDetails,
redirectToCustomerPortal,
- syncUserDetails,
userDetailsAddOnBonuses,
type UserDetails,
} from "ente-new/photos/services/user-details";
@@ -230,7 +230,7 @@ const UserDetailsSection: React.FC<UserDetailsSectionProps> = ({
} = useModalVisibility();
useEffect(() => {
- if (sidebarOpen) void syncUserDetails();
+ if (sidebarOpen) void pullUserDetails();
}, [sidebarOpen]);
const isNonAdminFamilyMember = useMemo(
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index b41eb83304..9fa258405f 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -91,7 +91,7 @@ import {
import type { SearchOption } from "ente-new/photos/services/search/types";
import { initSettings } from "ente-new/photos/services/settings";
import {
- initUserDetailsOrTriggerSync,
+ initUserDetailsOrTriggerPull,
redirectToCustomerPortal,
userDetailsSnapshot,
verifyStripeSubscription,
@@ -296,7 +296,7 @@ const Page: React.FC = () => {
return;
}
initSettings();
- await initUserDetailsOrTriggerSync();
+ await initUserDetailsOrTriggerPull();
setupSelectAllKeyBoardShortcutHandler();
dispatch({ type: "showAll" });
setIsFirstLoad(isFirstLogin());
diff --git a/web/apps/photos/tests/upload.test.ts b/web/apps/photos/tests/upload.test.ts
index 3a8f30889c..00da88aea2 100644
--- a/web/apps/photos/tests/upload.test.ts
+++ b/web/apps/photos/tests/upload.test.ts
@@ -18,7 +18,7 @@ import {
savedCollectionFiles,
savedCollections,
} from "ente-new/photos/services/photos-fdb";
-import { getUserDetailsV2 } from "ente-new/photos/services/user-details";
+import { userDetailsSnapshot } from "ente-new/photos/services/user-details";
const DATE_TIME_PARSING_TEST_FILE_NAMES = [
{
@@ -170,7 +170,7 @@ export async function testUpload() {
}
async function totalFileCountCheck(expectedState) {
- const userDetails = await getUserDetailsV2();
+ const userDetails = userDetailsSnapshot();
if (expectedState.total_file_count === userDetails.fileCount) {
console.log("file count check passed βœ…");
} else {
diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.ts
index 3ec6c44e26..aa73cfa22e 100644
--- a/web/packages/new/photos/services/ml/index.ts
+++ b/web/packages/new/photos/services/ml/index.ts
@@ -56,7 +56,7 @@ class MLState {
*
* - On app start, this is read from local storage during {@link initML}.
*
- * - It gets updated when we sync with remote (so if the user
+ * - It gets updated when we pull from remote (so if the user
* enables/disables ML on a different device, this local value will also
* become true/false).
*
diff --git a/web/packages/new/photos/services/user-details.ts b/web/packages/new/photos/services/user-details.ts
index e5839edd3d..a8b2392438 100644
--- a/web/packages/new/photos/services/user-details.ts
+++ b/web/packages/new/photos/services/user-details.ts
@@ -183,12 +183,12 @@ export const logoutUserDetails = () => {
*
* This assumes that the user is already logged in.
*/
-export const initUserDetailsOrTriggerSync = async () => {
+export const initUserDetailsOrTriggerPull = async () => {
const saved = await getKV("userDetails");
if (saved) {
setUserDetailsSnapshot(UserDetails.parse(saved));
} else {
- void syncUserDetails();
+ void pullUserDetails();
}
};
@@ -231,8 +231,8 @@ const setUserDetailsSnapshot = (snapshot: UserDetails) => {
* Fetch the user's details from remote and save them in local storage for
* subsequent lookup, and also update our in-memory snapshots.
*/
-export const syncUserDetails = async () => {
- const userDetails = await getUserDetailsV2();
+export const pullUserDetails = async () => {
+ const userDetails = await getUserDetails();
await setKV("userDetails", userDetails);
setUserDetailsSnapshot(userDetails);
@@ -248,7 +248,7 @@ export const syncUserDetails = async () => {
/**
* Fetch the user details for the currently logged in user from remote.
*/
-export const getUserDetailsV2 = async () => {
+const getUserDetails = async () => {
const res = await fetch(await apiURL("/users/details/v2"), {
headers: await authenticatedRequestHeaders(),
});
@@ -326,7 +326,7 @@ export const verifyStripeSubscription = async (
}),
}),
);
- await syncUserDetails();
+ await pullUserDetails();
return userDetailsSnapshot()!.subscription;
};
@@ -342,7 +342,7 @@ export const activateStripeSubscription = async () => {
headers: await authenticatedRequestHeaders(),
}),
);
- return syncUserDetails();
+ return pullUserDetails();
};
/**
@@ -356,7 +356,7 @@ export const cancelStripeSubscription = async () => {
headers: await authenticatedRequestHeaders(),
}),
);
- return syncUserDetails();
+ return pullUserDetails();
};
const paymentsAppOrigin = "https://payments.ente.io";
@@ -539,7 +539,8 @@ const getFamiliesTokenAndURL = async () => {
/**
* Update remote to indicate that the user wants to leave the family plan that
- * they are part of, then our local sync user details with remote.
+ * they are part of, then update our local user details by pulling the latest
+ * ones from remote.
*/
export const leaveFamily = async () => {
ensureOk(
@@ -548,7 +549,7 @@ export const leaveFamily = async () => {
headers: await authenticatedRequestHeaders(),
}),
);
- return syncUserDetails();
+ return pullUserDetails();
};
/**