Skip to content

armgit / ente

Public Imported from GitHub
0

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

Restore photos upload and expiry fixes

Anand Baburajan512f3cbef756
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index c5af2e4732..9ff9efa81e 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -2007,7 +2007,9 @@ const ManageLinkExpiry: React.FC<ManagePublicLinkSettingDrawerProps> = ({
isLinkExpired(publicURL.validTill)
? t("link_expired")
: publicURL.validTill
- ? formattedDateTime(publicURL.validTill)
+ ? formattedDateTime(publicURL.validTill, {
+ omitWeekdayWhenYearIncluded: true,
+ })
: t("never")
}
/>
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index 0c54597968..2a5b4ba2ef 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -331,7 +331,7 @@ export const Upload: React.FC<UploadProps> = ({
const electron = globalThis.electron;
- const closeUploadProgress = () => setUploadProgressView(false);
+ const closeUploadProgress = () => uploadManager.hideUploadProgressDialog();
const handleCollectionMappingChoiceClose = () => {
setOpenCollectionMappingChoice(false);
@@ -360,7 +360,7 @@ export const Upload: React.FC<UploadProps> = ({
);
if (uploadManager.isUploadRunning()) {
- setUploadProgressView(true);
+ uploadManager.showUploadProgressDialog();
}
if (electron) {
@@ -577,7 +577,7 @@ export const Upload: React.FC<UploadProps> = ({
onCloseCollectionSelector?.();
props.setShouldDisableDropzone(uploadManager.isUploadInProgress());
setUploadPhase("preparing");
- setUploadProgressView(true);
+ uploadManager.showUploadProgressDialog();
};
const uploadFilesToExistingCollection = async (collection: Collection) => {
@@ -681,7 +681,7 @@ export const Upload: React.FC<UploadProps> = ({
parsedMetadataJSONMap?: Map<string, ParsedMetadataJSON>,
) => {
uploadManager.prepareForNewUpload(parsedMetadataJSONMap);
- setUploadProgressView(true);
+ uploadManager.showUploadProgressDialog();
await onRemotePull({ silent: true });
};
diff --git a/web/apps/photos/src/services/upload-manager.ts b/web/apps/photos/src/services/upload-manager.ts
index edf2fa5f2b..22b2231a72 100644
--- a/web/apps/photos/src/services/upload-manager.ts
+++ b/web/apps/photos/src/services/upload-manager.ts
@@ -304,6 +304,10 @@ class UploadManager {
this.uiService.setUploadProgressView(true);
}
+ hideUploadProgressDialog() {
+ this.uiService.setUploadProgressView(false);
+ }
+
/**
* Upload files
*
diff --git a/web/packages/base/i18n-date.ts b/web/packages/base/i18n-date.ts
index 05cc4fd8af..8b70cb4d1b 100644
--- a/web/packages/base/i18n-date.ts
+++ b/web/packages/base/i18n-date.ts
@@ -13,6 +13,12 @@ const _dateFormat = new Intl.DateTimeFormat(i18n.language, {
year: "numeric",
});
+const _dateWithoutWeekdayFormat = new Intl.DateTimeFormat(i18n.language, {
+ day: "numeric",
+ month: "short",
+ year: "numeric",
+});
+
const _dateWithoutYearFormat = new Intl.DateTimeFormat(i18n.language, {
weekday: "short",
day: "numeric",
@@ -23,6 +29,10 @@ const _timeFormat = new Intl.DateTimeFormat(i18n.language, {
timeStyle: "short",
});
+interface FormattedDateOptions {
+ omitWeekdayWhenYearIncluded?: boolean;
+}
+
/**
* Return a locale aware formatted date from the given {@link Date}.
*
@@ -33,8 +43,13 @@ const _timeFormat = new Intl.DateTimeFormat(i18n.language, {
*
* - Otherwise, the year is included, e.g., "Fri, 21 Feb 2025".
*/
-export const formattedDate = (date: Date) =>
- (isSameYear(date) ? _dateWithoutYearFormat : _dateFormat).format(date);
+export const formattedDate = (date: Date, options?: FormattedDateOptions) =>
+ (isSameYear(date)
+ ? _dateWithoutYearFormat
+ : options?.omitWeekdayWhenYearIncluded
+ ? _dateWithoutWeekdayFormat
+ : _dateFormat
+ ).format(date);
const isSameYear = (date: Date) =>
new Date().getFullYear() === date.getFullYear();
@@ -66,11 +81,13 @@ export const formattedTime = (date: Date) => _timeFormat.format(date);
* date, or it can be given the raw epoch microseconds value and it'll convert
* internally.
*/
-export const formattedDateTime = (dateOrEpochMicroseconds: Date | number) =>
- _formattedDateTime(toDate(dateOrEpochMicroseconds));
+export const formattedDateTime = (
+ dateOrEpochMicroseconds: Date | number,
+ options?: FormattedDateOptions,
+) => _formattedDateTime(toDate(dateOrEpochMicroseconds), options);
-const _formattedDateTime = (date: Date) =>
- [formattedDate(date), t("at"), formattedTime(date)].join(" ");
+const _formattedDateTime = (date: Date, options?: FormattedDateOptions) =>
+ [formattedDate(date, options), t("at"), formattedTime(date)].join(" ");
const toDate = (dm: Date | number) =>
typeof dm == "number" ? new Date(dm / 1000) : dm;