added support for showing collab album in collection selector add to album

This commit is contained in:
Abhinav 2023-07-03 12:01:33 +05:30
parent 19d146c4a9
commit 029bd7fb93
2 changed files with 20 additions and 7 deletions

View file

@ -18,8 +18,11 @@ import {
DUMMY_UNCATEGORIZED_SECTION,
} from 'constants/collection';
import { t } from 'i18next';
import { isSelectAllowedCollection } from 'utils/collection';
import { createUnCategorizedCollection } from 'services/collectionService';
import {
isAddToAllowedCollection,
isMoveToAllowedCollection,
} from 'utils/collection';
export interface CollectionSelectorAttributes {
callback: (collection: Collection) => void;
@ -56,15 +59,19 @@ function CollectionSelector({
?.filter(({ id, type }) => {
if (id === attributes.fromCollection) {
return false;
} else if (
attributes.intent === CollectionSelectorIntent.add
) {
return isAddToAllowedCollection(type);
} else if (
attributes.intent === CollectionSelectorIntent.upload
) {
return (
isSelectAllowedCollection(type) ||
isMoveToAllowedCollection(type) ||
type === CollectionSummaryType.uncategorized
);
} else {
return isSelectAllowedCollection(type);
return isMoveToAllowedCollection(type);
}
})
.sort((a, b) => {

View file

@ -28,7 +28,8 @@ import {
HIDE_FROM_COLLECTION_BAR_TYPES,
OPTIONS_NOT_HAVING_COLLECTION_TYPES,
SYSTEM_COLLECTION_TYPES,
SELECT_NOT_ALLOWED_COLLECTION,
MOVE_TO_NOT_ALLOWED_COLLECTION,
ADD_TO_NOT_ALLOWED_COLLECTION,
} from 'constants/collection';
import { getUnixTimeInMicroSecondsWithDelta } from 'utils/time';
import { SUB_TYPE, VISIBILITY_STATE } from 'types/magicMetadata';
@ -237,8 +238,12 @@ export const hasNonSystemCollections = (
return false;
};
export const isSelectAllowedCollection = (type: CollectionSummaryType) => {
return !SELECT_NOT_ALLOWED_COLLECTION.has(type);
export const isMoveToAllowedCollection = (type: CollectionSummaryType) => {
return !MOVE_TO_NOT_ALLOWED_COLLECTION.has(type);
};
export const isAddToAllowedCollection = (type: CollectionSummaryType) => {
return !ADD_TO_NOT_ALLOWED_COLLECTION.has(type);
};
export const isSystemCollection = (type: CollectionSummaryType) => {
@ -258,7 +263,8 @@ export const showDownloadQuickOption = (type: CollectionSummaryType) => {
type === CollectionSummaryType.album ||
type === CollectionSummaryType.uncategorized ||
type === CollectionSummaryType.hidden ||
type === CollectionSummaryType.incomingShare ||
type === CollectionSummaryType.incomingShareViewer ||
type === CollectionSummaryType.incomingShareCollaborator ||
type === CollectionSummaryType.outgoingShare ||
type === CollectionSummaryType.sharedOnlyViaLink ||
type === CollectionSummaryType.archived