Skip to content

armgit / ente

Public Imported from GitHub
0

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

Time upd

Manav Rathib3bb79ecd43e
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index d91f0bd3b7..59d8415cee 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -63,7 +63,6 @@ import {
fileFileName,
fileLocation,
filePublicMagicMetadata,
- updateRemotePublicMagicMetadata,
type ParsedMetadata,
type ParsedMetadataDate,
} from "ente-media/file-metadata";
@@ -78,6 +77,7 @@ import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapsh
import {
updateFileCaption,
updateFileFileName,
+ updateFilePublicMagicMetadata,
} from "ente-new/photos/services/file";
import {
getAnnotatedFacesForFile,
@@ -290,7 +290,14 @@ export const FileInfo: React.FC<FileInfoProps> = ({
onUpdateCaption,
}}
/>
- <CreationTime {...{ file, allowEdits, onNeedsRemoteSync }} />
+ <CreationTime
+ {...{
+ file,
+ allowEdits,
+ onNeedsRemoteSync,
+ onFileAndCollectionSyncWithRemote,
+ }}
+ />
<FileName
{...{
file,
@@ -673,13 +680,14 @@ const CaptionForm = styled("form")(({ theme }) => ({
type CreationTimeProps = Pick<
FileInfoProps,
- "allowEdits" | "onNeedsRemoteSync"
+ "allowEdits" | "onNeedsRemoteSync" | "onFileAndCollectionSyncWithRemote"
> & { file: EnteFile };
const CreationTime: React.FC<CreationTimeProps> = ({
file,
allowEdits,
onNeedsRemoteSync,
+ onFileAndCollectionSyncWithRemote,
}) => {
const { onGenericError } = useBaseContext();
@@ -713,10 +721,8 @@ const CreationTime: React.FC<CreationTimeProps> = ({
// we can provide functionality for the user to edit the associated
// offset, but right now it is not even surfaced, so don't also
// potentially overwrite it.
- await updateRemotePublicMagicMetadata(file, {
- dateTime,
- editedTime,
- });
+ await updateFilePublicMagicMetadata(file, { dateTime, editedTime });
+ await onFileAndCollectionSyncWithRemote();
} catch (e) {
onGenericError(e);
}
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 4afdbf8833..5858b20204 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -830,8 +830,8 @@ export const FileViewer: React.FC<FileViewerProps> = ({
// the other attributes of the annotated file currently depend on
// the archive status change.
//
- // - Similar reasoning applies to updates to the file's file name in
- // file info panel.
+ // - Similar reasoning applies to updates to the file's file name or
+ // date in the file info panel.
//
// - For updates to the file's caption in the file info panel we
// already need special casing (see `updateItemDataAlt`) to reload
diff --git a/web/packages/new/photos/services/file.ts b/web/packages/new/photos/services/file.ts
index 957bd0a44e..4716054e5c 100644
--- a/web/packages/new/photos/services/file.ts
+++ b/web/packages/new/photos/services/file.ts
@@ -166,7 +166,7 @@ const putFilesMagicMetadata = async (
* @param newFileName The new file name of the file.
*/
export const updateFileFileName = (file: EnteFile2, newFileName: string) =>
- updateFilesPublicMagicMetadata([file], { editedName: newFileName });
+ updateFilePublicMagicMetadata(file, { editedName: newFileName });
/**
* Update the caption associated with the provided file on remote.
@@ -185,10 +185,27 @@ export const updateFileFileName = (file: EnteFile2, newFileName: string) =>
* caption to the default (no value) state pass a blank string.
*/
export const updateFileCaption = (file: EnteFile2, caption: string) =>
- updateFilesPublicMagicMetadata([file], { caption });
+ updateFilePublicMagicMetadata(file, { caption });
/**
- * Update the private magic metadata of a list of files on remote.
+ * Update the public magic metadata of a file on remote.
+ *
+ * Remote only, does not modify local state.
+ *
+ * @param file The list of files whose magic metadata we want to update.
+ *
+ * @param updates A non-empty but otherwise arbitrary subset of
+ * {@link FilePrivateMagicMetadataData} entries.
+ *
+ * See: [Note: Magic metadata data cannot have nullish values]
+ */
+export const updateFilePublicMagicMetadata = async (
+ file: EnteFile2,
+ updates: PublicMagicMetadata,
+) => updateFilesPublicMagicMetadata([file], updates);
+
+/**
+ * Update the public magic metadata of a list of files on remote.
*
* Remote only, does not modify local state.
*