dav: extend archive with stack

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/900/head
Varun Patil 2023-10-30 11:43:50 -07:00
parent ef44965dee
commit 782b2c9243
2 changed files with 6 additions and 3 deletions

View File

@ -28,6 +28,9 @@ async function archiveFile(fileid: number, archive: boolean) {
export async function* archiveFilesByIds(photos: IPhoto[], archive: boolean) {
if (!photos.length) return;
// Add stack files
photos = await base.extendWithStack(photos);
// Archive each file
const calls = photos.map((photo) => async () => {
try {

View File

@ -171,7 +171,7 @@ export async function* runInParallel<T>(promises: (() => Promise<T>)[], n: numbe
*
* @returns list of file ids that contains extra file Ids
*/
async function extendWithStack(photos: IPhoto[]) {
export async function extendWithStack(photos: IPhoto[]) {
// Add Live Photos files
const livePhotos = (
await Promise.all(
@ -206,7 +206,7 @@ async function extendWithStack(photos: IPhoto[]) {
export async function* deletePhotos(photos: IPhoto[], confirm: boolean = true) {
if (photos.length === 0) return;
// Extend with Live Photos unless this is an album
// Extend with stack unless this is an album
const routeIsAlbums = _m.route.name === _m.routes.Albums.name;
if (!routeIsAlbums) {
photos = await extendWithStack(photos);
@ -296,7 +296,7 @@ export async function* movePhotos(photos: IPhoto[], destination: string, overwri
targetPath += '/';
}
// Also move the Live Photo videos
// Also move the stack files
photos = await extendWithStack(photos);
const fileIdsSet = new Set(photos.map((p) => p.fileid));