Selaa lähdekoodia

update behaviour to not move to destination collection after collection ops (#1556)

Abhinav Kumar 1 vuosi sitten
vanhempi
commit
4e9fb6a632
1 muutettua tiedostoa jossa 20 lisäystä ja 5 poistoa
  1. 20 5
      apps/photos/src/pages/gallery/index.tsx

+ 20 - 5
apps/photos/src/pages/gallery/index.tsx

@@ -836,13 +836,20 @@ export default function Gallery() {
                         selected.collectionID
                     );
                 }
-
+                if (selected?.ownCount === filteredData?.length) {
+                    if (
+                        ops === COLLECTION_OPS_TYPE.REMOVE ||
+                        ops === COLLECTION_OPS_TYPE.RESTORE ||
+                        ops === COLLECTION_OPS_TYPE.MOVE
+                    ) {
+                        // redirect to all section when no items are left in the current collection.
+                        setActiveCollectionID(ALL_SECTION);
+                    } else if (ops === COLLECTION_OPS_TYPE.UNHIDE) {
+                        exitHiddenSection();
+                    }
+                }
                 clearSelection();
                 await syncWithRemote(false, true);
-                if (isInHiddenSection && ops === COLLECTION_OPS_TYPE.UNHIDE) {
-                    exitHiddenSection();
-                }
-                setActiveCollectionID(collection.id);
             } catch (e) {
                 logError(e, 'collection ops failed', { ops });
                 setDialogMessage({
@@ -877,6 +884,14 @@ export default function Gallery() {
                     setFixCreationTimeAttributes
                 );
             }
+            if (
+                selected?.ownCount === filteredData?.length &&
+                ops !== FILE_OPS_TYPE.ARCHIVE &&
+                ops !== FILE_OPS_TYPE.DOWNLOAD &&
+                ops !== FILE_OPS_TYPE.FIX_TIME
+            ) {
+                setActiveCollectionID(ALL_SECTION);
+            }
             clearSelection();
             await syncWithRemote(false, true);
         } catch (e) {