1
0
mirror of https://github.com/immich-app/immich.git synced 2025-02-07 18:50:19 +02:00

fix(server): for individual shares not showing thumbnails (#15895)

* Fix for individual shares not showing thumbnails

* synced sql

* chore: add e2e test

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Lukas 2025-02-04 04:07:50 -05:00 committed by GitHub
parent b730aa60ed
commit 0bb1219b5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -89,7 +89,7 @@ describe('/shared-links', () => {
await deleteUserAdmin({ id: user2.userId, userAdminDeleteDto: {} }, { headers: asBearerAuth(admin.accessToken) });
});
describe('GET /share/${key}', () => {
describe('GET /share/:key', () => {
it('should have correct asset count in meta tag for non-empty album', async () => {
const resp = await request(shareUrl).get(`/${linkWithMetadata.key}`);
expect(resp.status).toBe(200);
@ -139,7 +139,10 @@ describe('/shared-links', () => {
expect(body).toEqual(
expect.arrayContaining([
expect.objectContaining({ id: linkWithAlbum.id }),
expect.objectContaining({ id: linkWithAssets.id }),
expect.objectContaining({
id: linkWithAssets.id,
assets: expect.arrayContaining([expect.objectContaining({ id: asset1.id })]),
}),
expect.objectContaining({ id: linkWithPassword.id }),
expect.objectContaining({ id: linkWithMetadata.id }),
expect.objectContaining({ id: linkWithoutMetadata.id }),

View File

@ -100,13 +100,14 @@ order by
-- SharedLinkRepository.getAll
select distinct
on ("shared_links"."createdAt") "shared_links".*,
to_json("assets") as "assets",
to_json("album") as "album"
from
"shared_links"
left join "shared_link__asset" on "shared_link__asset"."sharedLinksId" = "shared_links"."id"
left join lateral (
select
"assets".*
json_agg("assets") as "assets"
from
"assets"
where

View File

@ -103,12 +103,13 @@ export class SharedLinkRepository implements ISharedLinkRepository {
(eb) =>
eb
.selectFrom('assets')
.select((eb) => eb.fn.jsonAgg('assets').as('assets'))
.whereRef('assets.id', '=', 'shared_link__asset.assetsId')
.where('assets.deletedAt', 'is', null)
.selectAll('assets')
.as('assets'),
(join) => join.onTrue(),
)
.select((eb) => eb.fn.toJson('assets').as('assets'))
.leftJoinLateral(
(eb) =>
eb