mirror of
https://github.com/immich-app/immich.git
synced 2025-06-21 22:40:50 -04:00
fix: count album comments and likes correctly (#19114)
This commit is contained in:
parent
c03e72c1da
commit
bedcf50196
@ -75,8 +75,8 @@ from
|
||||
inner join "users" on "users"."id" = "activity"."userId"
|
||||
and "users"."deletedAt" is null
|
||||
left join "assets" on "assets"."id" = "activity"."assetId"
|
||||
and "assets"."deletedAt" is null
|
||||
and "assets"."visibility" != 'locked'
|
||||
where
|
||||
"activity"."assetId" = $3
|
||||
and "activity"."albumId" = $4
|
||||
and "assets"."deletedAt" is null
|
||||
and "assets"."visibility" != 'locked'
|
||||
|
@ -81,11 +81,14 @@ export class ActivityRepository {
|
||||
eb.fn.countAll<number>().filterWhere('activity.isLiked', '=', true).as('likes'),
|
||||
])
|
||||
.innerJoin('users', (join) => join.onRef('users.id', '=', 'activity.userId').on('users.deletedAt', 'is', null))
|
||||
.leftJoin('assets', 'assets.id', 'activity.assetId')
|
||||
.leftJoin('assets', (join) =>
|
||||
join
|
||||
.onRef('assets.id', '=', 'activity.assetId')
|
||||
.on('assets.deletedAt', 'is', null)
|
||||
.on('assets.visibility', '!=', sql.lit(AssetVisibility.LOCKED)),
|
||||
)
|
||||
.$if(!!assetId, (qb) => qb.where('activity.assetId', '=', assetId!))
|
||||
.where('activity.albumId', '=', albumId)
|
||||
.where('assets.deletedAt', 'is', null)
|
||||
.where('assets.visibility', '!=', sql.lit(AssetVisibility.LOCKED))
|
||||
.executeTakeFirstOrThrow();
|
||||
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user