mirror of
https://github.com/immich-app/immich.git
synced 2025-12-30 01:11:52 +03:00
feat(web): display number of likes in asset viewer (#18911)
* feat: display number of likes * fix: properly decrement like count on unlike Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> * chore: pr feedback * chore: updated related test * chore: formatter run * chore: force numberOfLikes to null in album context to pass lint * chore: open-api updated * fix: use undefined, not null * styling tweaks * chore: updated sql --------- Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -54,13 +54,13 @@ describe(ActivityService.name, () => {
|
||||
});
|
||||
|
||||
describe('getStatistics', () => {
|
||||
it('should get the comment count', async () => {
|
||||
it('should get the comment and like count', async () => {
|
||||
const [albumId, assetId] = newUuids();
|
||||
|
||||
mocks.activity.getStatistics.mockResolvedValue(1);
|
||||
mocks.activity.getStatistics.mockResolvedValue({ comments: 1, likes: 3 });
|
||||
mocks.access.album.checkOwnerAccess.mockResolvedValue(new Set([albumId]));
|
||||
|
||||
await expect(sut.getStatistics(factory.auth(), { assetId, albumId })).resolves.toEqual({ comments: 1 });
|
||||
await expect(sut.getStatistics(factory.auth(), { assetId, albumId })).resolves.toEqual({ comments: 1, likes: 3 });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export class ActivityService extends BaseService {
|
||||
|
||||
async getStatistics(auth: AuthDto, dto: ActivityDto): Promise<ActivityStatisticsResponseDto> {
|
||||
await this.requireAccess({ auth, permission: Permission.ALBUM_READ, ids: [dto.albumId] });
|
||||
return { comments: await this.activityRepository.getStatistics({ albumId: dto.albumId, assetId: dto.assetId }) };
|
||||
return await this.activityRepository.getStatistics({ albumId: dto.albumId, assetId: dto.assetId });
|
||||
}
|
||||
|
||||
async create(auth: AuthDto, dto: ActivityCreateDto): Promise<MaybeDuplicate<ActivityResponseDto>> {
|
||||
|
||||
Reference in New Issue
Block a user