π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Handle timezone differences in single-file quick links
Anand Baburajan9cc640866ed3
diff --git a/web/apps/albums/src/public-album/page/PublicAlbumPage.tsx b/web/apps/albums/src/public-album/page/PublicAlbumPage.tsxindex b8b7258c7c..72ee653407 100644--- a/web/apps/albums/src/public-album/page/PublicAlbumPage.tsx+++ b/web/apps/albums/src/public-album/page/PublicAlbumPage.tsx@@ -65,10 +65,13 @@ import {useSaveGroupsActions,type AddSaveGroup,} from "ente-gallery/components/utils/save-groups";-import { quickLinkDateRangeForFiles } from "ente-gallery/utils/quick-link";+import {+ isPossibleSingleFileQuickLinkName,+ quickLinkDateRangeForFiles,+} from "ente-gallery/utils/quick-link";import type { Collection } from "ente-media/collection";import type { EnteFile } from "ente-media/file";-import { fileFileName } from "ente-media/file-metadata";+import { fileCreationTime, fileFileName } from "ente-media/file-metadata";import { FileType } from "ente-media/file-type";import {GalleryItemsHeaderAdapter,@@ -683,10 +686,16 @@ export default function PublicAlbumPage() {const layout = publicAlbumLayout;const quickLinkDateRange = quickLinkDateRangeForFiles(publicFiles);+ const isSingleFileAlbum = publicFiles.length === 1;const isQuickLinkAlbum =quickLinkDateRange !== undefined &&- publicCollection?.name === quickLinkDateRange;- const isSingleFileAlbum = publicFiles.length === 1;+ (publicCollection?.name === quickLinkDateRange ||+ (isSingleFileAlbum &&+ publicCollection !== undefined &&+ isPossibleSingleFileQuickLinkName(+ publicCollection.name,+ fileCreationTime(publicFiles[0]!),+ )));const shouldShowSingleFileViewer = isQuickLinkAlbum && isSingleFileAlbum;if (shouldShowSingleFileViewer) {diff --git a/web/packages/gallery/utils/quick-link.ts b/web/packages/gallery/utils/quick-link.tsindex 7e8743a1bd..66ae929645 100644--- a/web/packages/gallery/utils/quick-link.ts+++ b/web/packages/gallery/utils/quick-link.ts@@ -18,6 +18,20 @@ const shortMonths = ["Dec",];+const possibleSingleFileQuickLinkOffsets = [-12 * 60, 0, 14 * 60];++export const isPossibleSingleFileQuickLinkName = (+ name: string,+ creationTime: number,+) =>+ possibleSingleFileQuickLinkOffsets.some((offsetMinutes) => {+ const date = new Date(creationTime / 1000 + offsetMinutes * 60 * 1000);+ return (+ name ===+ `${shortMonths[date.getUTCMonth() + 1]} ${date.getUTCDate()}, ${date.getUTCFullYear()}`+ );+ });+// Keep date formatting in sync with mobile.export const quickLinkDateRangeForCreationTimes = (firstCreationTime: number,