dav: extend archive with stack
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/900/head
parent
ef44965dee
commit
782b2c9243
|
@ -28,6 +28,9 @@ async function archiveFile(fileid: number, archive: boolean) {
|
||||||
export async function* archiveFilesByIds(photos: IPhoto[], archive: boolean) {
|
export async function* archiveFilesByIds(photos: IPhoto[], archive: boolean) {
|
||||||
if (!photos.length) return;
|
if (!photos.length) return;
|
||||||
|
|
||||||
|
// Add stack files
|
||||||
|
photos = await base.extendWithStack(photos);
|
||||||
|
|
||||||
// Archive each file
|
// Archive each file
|
||||||
const calls = photos.map((photo) => async () => {
|
const calls = photos.map((photo) => async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -171,7 +171,7 @@ export async function* runInParallel<T>(promises: (() => Promise<T>)[], n: numbe
|
||||||
*
|
*
|
||||||
* @returns list of file ids that contains extra file Ids
|
* @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
|
// Add Live Photos files
|
||||||
const livePhotos = (
|
const livePhotos = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
@ -206,7 +206,7 @@ async function extendWithStack(photos: IPhoto[]) {
|
||||||
export async function* deletePhotos(photos: IPhoto[], confirm: boolean = true) {
|
export async function* deletePhotos(photos: IPhoto[], confirm: boolean = true) {
|
||||||
if (photos.length === 0) return;
|
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;
|
const routeIsAlbums = _m.route.name === _m.routes.Albums.name;
|
||||||
if (!routeIsAlbums) {
|
if (!routeIsAlbums) {
|
||||||
photos = await extendWithStack(photos);
|
photos = await extendWithStack(photos);
|
||||||
|
@ -296,7 +296,7 @@ export async function* movePhotos(photos: IPhoto[], destination: string, overwri
|
||||||
targetPath += '/';
|
targetPath += '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also move the Live Photo videos
|
// Also move the stack files
|
||||||
photos = await extendWithStack(photos);
|
photos = await extendWithStack(photos);
|
||||||
const fileIdsSet = new Set(photos.map((p) => p.fileid));
|
const fileIdsSet = new Set(photos.map((p) => p.fileid));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue