conv
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
EncryptedCollection,
|
||||
PublicURL,
|
||||
RemoveFromCollectionRequest,
|
||||
SUB_TYPE,
|
||||
CollectionSubType,
|
||||
UpdatePublicURL,
|
||||
} from "@/media/collection";
|
||||
import { EncryptedMagicMetadata, EnteFile } from "@/media/file";
|
||||
@@ -469,7 +469,7 @@ export const renameCollection = async (
|
||||
) => {
|
||||
if (isQuickLinkCollection(collection)) {
|
||||
// Convert quick link collection to normal collection on rename
|
||||
await changeCollectionSubType(collection, SUB_TYPE.DEFAULT);
|
||||
await changeCollectionSubType(collection, CollectionSubType.default);
|
||||
}
|
||||
const token = getToken();
|
||||
const cryptoWorker = await sharedCryptoWorker();
|
||||
@@ -683,7 +683,7 @@ export async function getDefaultHiddenCollection(): Promise<Collection> {
|
||||
|
||||
export function createHiddenCollection() {
|
||||
return createCollection(HIDDEN_COLLECTION_NAME, "album", {
|
||||
subType: SUB_TYPE.DEFAULT_HIDDEN,
|
||||
subType: CollectionSubType.defaultHidden,
|
||||
visibility: ItemVisibility.hidden,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type Collection,
|
||||
CollectionMagicMetadataProps,
|
||||
CollectionPublicMagicMetadataProps,
|
||||
SUB_TYPE,
|
||||
CollectionSubType,
|
||||
} from "@/media/collection";
|
||||
import { EnteFile } from "@/media/file";
|
||||
import { ItemVisibility } from "@/media/file-metadata";
|
||||
@@ -273,7 +273,7 @@ export const changeCollectionOrder = async (
|
||||
|
||||
export const changeCollectionSubType = async (
|
||||
collection: Collection,
|
||||
subType: SUB_TYPE,
|
||||
subType: CollectionSubType,
|
||||
) => {
|
||||
try {
|
||||
const updatedMagicMetadataProps: CollectionMagicMetadataProps = {
|
||||
@@ -301,7 +301,7 @@ export const getUserOwnedCollections = (collections: Collection[]) => {
|
||||
};
|
||||
|
||||
export const isQuickLinkCollection = (collection: Collection) =>
|
||||
collection.magicMetadata?.data.subType === SUB_TYPE.QUICK_LINK_COLLECTION;
|
||||
collection.magicMetadata?.data.subType == CollectionSubType.quicklink;
|
||||
|
||||
export function isIncomingViewerShare(collection: Collection, user: User) {
|
||||
const sharee = collection.sharees?.find((sharee) => sharee.id === user.id);
|
||||
|
||||
@@ -102,15 +102,18 @@ export interface RemoveFromCollectionRequest {
|
||||
fileIDs: number[];
|
||||
}
|
||||
|
||||
export enum SUB_TYPE {
|
||||
DEFAULT = 0,
|
||||
DEFAULT_HIDDEN = 1,
|
||||
QUICK_LINK_COLLECTION = 2,
|
||||
}
|
||||
export const CollectionSubType = {
|
||||
default: 0,
|
||||
defaultHidden: 1,
|
||||
quicklink: 2,
|
||||
} as const;
|
||||
|
||||
export type CollectionSubType =
|
||||
(typeof CollectionSubType)[keyof typeof CollectionSubType];
|
||||
|
||||
export interface CollectionMagicMetadataProps {
|
||||
visibility?: ItemVisibility;
|
||||
subType?: SUB_TYPE;
|
||||
subType?: CollectionSubType;
|
||||
order?: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { encryptBoxB64 } from "@/base/crypto";
|
||||
import { authenticatedRequestHeaders, ensureOk } from "@/base/http";
|
||||
import { apiURL } from "@/base/origins";
|
||||
import { SUB_TYPE, type Collection } from "@/media/collection";
|
||||
import { CollectionSubType, type Collection } from "@/media/collection";
|
||||
import { type EnteFile } from "@/media/file";
|
||||
import { ItemVisibility } from "@/media/file-metadata";
|
||||
import { batch } from "@/utils/array";
|
||||
@@ -32,7 +32,7 @@ export const ALL_SECTION = 0;
|
||||
export const isDefaultHiddenCollection = (collection: Collection) =>
|
||||
// TODO: Need to audit the types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
collection.magicMetadata?.data.subType === SUB_TYPE.DEFAULT_HIDDEN;
|
||||
collection.magicMetadata?.data.subType == CollectionSubType.defaultHidden;
|
||||
|
||||
/**
|
||||
* Extract the IDs of all the "default" hidden collections.
|
||||
|
||||
Reference in New Issue
Block a user