mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: do not emit AlbumInvite event for owner (#28110)
This commit is contained in:
@@ -196,6 +196,7 @@ describe(AlbumService.name, () => {
|
|||||||
expect(mocks.user.get).toHaveBeenCalledWith(albumUser.userId, {});
|
expect(mocks.user.get).toHaveBeenCalledWith(albumUser.userId, {});
|
||||||
expect(mocks.user.getMetadata).toHaveBeenCalledWith(owner.id);
|
expect(mocks.user.getMetadata).toHaveBeenCalledWith(owner.id);
|
||||||
expect(mocks.access.asset.checkOwnerAccess).toHaveBeenCalledWith(owner.id, new Set([assetId]), false);
|
expect(mocks.access.asset.checkOwnerAccess).toHaveBeenCalledWith(owner.id, new Set([assetId]), false);
|
||||||
|
expect(mocks.event.emit).toHaveBeenCalledTimes(1);
|
||||||
expect(mocks.event.emit).toHaveBeenCalledWith('AlbumInvite', {
|
expect(mocks.event.emit).toHaveBeenCalledWith('AlbumInvite', {
|
||||||
id: album.id,
|
id: album.id,
|
||||||
userId: albumUser.userId,
|
userId: albumUser.userId,
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ export class AlbumService extends BaseService {
|
|||||||
throw new BadRequestException('Cannot share album with owner');
|
throw new BadRequestException('Cannot share album with owner');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
albumUsers.unshift({ userId: auth.user.id, role: AlbumUserRole.Owner });
|
|
||||||
|
|
||||||
const allowedAssetIdsSet = await this.checkAccess({
|
const allowedAssetIdsSet = await this.checkAccess({
|
||||||
auth,
|
auth,
|
||||||
@@ -133,7 +132,7 @@ export class AlbumService extends BaseService {
|
|||||||
order: getPreferences(userMetadata).albums.defaultAssetOrder,
|
order: getPreferences(userMetadata).albums.defaultAssetOrder,
|
||||||
},
|
},
|
||||||
assetIds,
|
assetIds,
|
||||||
albumUsers,
|
[{ userId: auth.user.id, role: AlbumUserRole.Owner }, ...albumUsers],
|
||||||
auth.user.id,
|
auth.user.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user