fix build issues
This commit is contained in:
parent
68cdf5abda
commit
a05de5c67e
|
@ -1,5 +1,4 @@
|
|||
import React, { useState } from 'react';
|
||||
import { updateFilePublicMagicMetadata } from 'services/fileService';
|
||||
import { EnteFile } from 'types/file';
|
||||
import { changeCaption, updateExistingFilePubMetadata } from 'utils/file';
|
||||
import { logError } from 'utils/sentry';
|
||||
|
@ -41,10 +40,7 @@ export function RenderCaption({
|
|||
}
|
||||
setCaption(newCaption);
|
||||
|
||||
let updatedFile = await changeCaption(file, newCaption);
|
||||
updatedFile = (
|
||||
await updateFilePublicMagicMetadata([updatedFile])
|
||||
)[0];
|
||||
const updatedFile = await changeCaption(file, newCaption);
|
||||
updateExistingFilePubMetadata(file, updatedFile);
|
||||
file.title = file.pubMagicMetadata.data.caption;
|
||||
refreshPhotoswipe();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import React, { useState } from 'react';
|
||||
import { updateFilePublicMagicMetadata } from 'services/fileService';
|
||||
import { EnteFile } from 'types/file';
|
||||
import CalendarTodayIcon from '@mui/icons-material/CalendarToday';
|
||||
import {
|
||||
|
@ -37,13 +36,10 @@ export function RenderCreationTime({
|
|||
closeEditMode();
|
||||
return;
|
||||
}
|
||||
let updatedFile = await changeFileCreationTime(
|
||||
const updatedFile = await changeFileCreationTime(
|
||||
file,
|
||||
unixTimeInMicroSec
|
||||
);
|
||||
updatedFile = (
|
||||
await updateFilePublicMagicMetadata([updatedFile])
|
||||
)[0];
|
||||
updateExistingFilePubMetadata(file, updatedFile);
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { updateFilePublicMagicMetadata } from 'services/fileService';
|
||||
import { EnteFile } from 'types/file';
|
||||
import {
|
||||
changeFileName,
|
||||
|
@ -82,10 +81,7 @@ export function RenderFileName({
|
|||
}
|
||||
setFilename(newFilename);
|
||||
const newTitle = getFileTitle(newFilename, extension);
|
||||
let updatedFile = await changeFileName(file, newTitle);
|
||||
updatedFile = (
|
||||
await updateFilePublicMagicMetadata([updatedFile])
|
||||
)[0];
|
||||
const updatedFile = await changeFileName(file, newTitle);
|
||||
updateExistingFilePubMetadata(file, updatedFile);
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
import { downloadFiles } from 'utils/file';
|
||||
import { getLocalFiles, getLocalHiddenFiles } from 'services/fileService';
|
||||
import { EnteFile } from 'types/file';
|
||||
import { CustomError, ServerErrorCodes } from 'utils/error';
|
||||
import { CustomError } from 'utils/error';
|
||||
import { User } from 'types/user';
|
||||
import { getData, LS_KEYS } from 'utils/storage/localStorage';
|
||||
import { logError } from 'utils/sentry';
|
||||
|
@ -172,11 +172,7 @@ export const changeCollectionVisibility = async (
|
|||
);
|
||||
await updateCollectionMagicMetadata(collection, updatedMagicMetadata);
|
||||
} catch (e) {
|
||||
logError(e, 'change file visibility failed');
|
||||
switch (e.status?.toString()) {
|
||||
case ServerErrorCodes.FORBIDDEN:
|
||||
throw Error(CustomError.NOT_FILE_OWNER);
|
||||
}
|
||||
logError(e, 'change collection visibility failed');
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
@ -185,16 +181,21 @@ export const changeCollectionSubType = async (
|
|||
collection: Collection,
|
||||
subType: SUB_TYPE
|
||||
) => {
|
||||
const updatedMagicMetadataProps: CollectionMagicMetadataProps = {
|
||||
subType: subType,
|
||||
};
|
||||
try {
|
||||
const updatedMagicMetadataProps: CollectionMagicMetadataProps = {
|
||||
subType: subType,
|
||||
};
|
||||
|
||||
const updatedMagicMetadata = await updateMagicMetadata(
|
||||
collection.magicMetadata ?? NEW_COLLECTION_MAGIC_METADATA,
|
||||
collection.key,
|
||||
updatedMagicMetadataProps
|
||||
);
|
||||
await updateCollectionMagicMetadata(collection, updatedMagicMetadata);
|
||||
const updatedMagicMetadata = await updateMagicMetadata(
|
||||
collection.magicMetadata ?? NEW_COLLECTION_MAGIC_METADATA,
|
||||
collection.key,
|
||||
updatedMagicMetadataProps
|
||||
);
|
||||
await updateCollectionMagicMetadata(collection, updatedMagicMetadata);
|
||||
} catch (e) {
|
||||
logError(e, 'change collection subType failed');
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
export const getArchivedCollections = (collections: Collection[]) => {
|
||||
|
|
|
@ -359,7 +359,7 @@ export function isExactTypeHEIC(exactType: string) {
|
|||
export async function changeFilesVisibility(
|
||||
files: EnteFile[],
|
||||
visibility: VISIBILITY_STATE
|
||||
) {
|
||||
): Promise<EnteFile[]> {
|
||||
const fileWithUpdatedMagicMetadataList: FileWithUpdatedMagicMetadata[] = [];
|
||||
for (const file of files) {
|
||||
const updatedMagicMetadataProps: FileMagicMetadataProps = {
|
||||
|
@ -375,8 +375,7 @@ export async function changeFilesVisibility(
|
|||
),
|
||||
});
|
||||
}
|
||||
await updateFileMagicMetadata(fileWithUpdatedMagicMetadataList);
|
||||
return fileWithUpdatedMagicMetadataList;
|
||||
return await updateFileMagicMetadata(fileWithUpdatedMagicMetadataList);
|
||||
}
|
||||
|
||||
export async function changeFileCreationTime(
|
||||
|
|
Loading…
Reference in a new issue