mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: remove from album
This commit is contained in:
@@ -265,13 +265,11 @@ export class AlbumService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async removeAssets(auth: AuthDto, id: string, dto: BulkIdsDto): Promise<BulkIdResponseDto[]> {
|
async removeAssets(auth: AuthDto, id: string, dto: BulkIdsDto): Promise<BulkIdResponseDto[]> {
|
||||||
await this.requireAccess({ auth, permission: Permission.AlbumAssetDelete, ids: [id] });
|
|
||||||
|
|
||||||
const album = await this.findOrFail(id, { withAssets: false });
|
const album = await this.findOrFail(id, { withAssets: false });
|
||||||
const results = await removeAssets(
|
const results = await removeAssets(
|
||||||
auth,
|
auth,
|
||||||
{ access: this.accessRepository, bulk: this.albumRepository },
|
{ access: this.accessRepository, bulk: this.albumRepository },
|
||||||
{ parentId: id, assetIds: dto.ids, canAlwaysRemove: Permission.AlbumDelete },
|
{ parentId: id, assetIds: dto.ids, canAlwaysRemove: Permission.AlbumUpdate },
|
||||||
);
|
);
|
||||||
|
|
||||||
const removedIds = results.filter(({ success }) => success).map(({ id }) => id);
|
const removedIds = results.filter(({ success }) => success).map(({ id }) => id);
|
||||||
|
|||||||
@@ -223,16 +223,6 @@ const checkOtherAccess = async (access: AccessRepository, request: OtherAccessRe
|
|||||||
return setUnion(isOwner, isShared);
|
return setUnion(isOwner, isShared);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Permission.AlbumAssetDelete: {
|
|
||||||
const isOwner = await access.album.checkOwnerAccess(auth.user.id, ids);
|
|
||||||
const isShared = await access.album.checkSharedAlbumAccess(
|
|
||||||
auth.user.id,
|
|
||||||
setDifference(ids, isOwner),
|
|
||||||
AlbumUserRole.Editor,
|
|
||||||
);
|
|
||||||
return setUnion(isOwner, isShared);
|
|
||||||
}
|
|
||||||
|
|
||||||
case Permission.AssetUpload: {
|
case Permission.AssetUpload: {
|
||||||
return ids.has(auth.user.id) ? new Set([auth.user.id]) : new Set<string>();
|
return ids.has(auth.user.id) ? new Set([auth.user.id]) : new Set<string>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user