fix(server): only asset owner should see favorite status (#20654)

* fix: Any asset update disables isFavorite action in GUI. Only owner of asset in album should see favorited image.

* Fix unit tests

* Fix formatting

* better query, add medium test

* update sql

---------

Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
This commit is contained in:
Paweł Wojtaszko
2025-10-16 23:52:36 +02:00
committed by GitHub
parent 24bfdf3263
commit 505e16c37c
7 changed files with 95 additions and 25 deletions

View File

@@ -296,7 +296,8 @@ with
"asset"."duration",
"asset"."id",
"asset"."visibility",
"asset"."isFavorite",
asset."isFavorite"
and asset."ownerId" = $1 as "isFavorite",
asset.type = 'IMAGE' as "isImage",
asset."deletedAt" is not null as "isTrashed",
"asset"."livePhotoVideoId",
@@ -341,14 +342,14 @@ with
where
"stacked"."stackId" = "asset"."stackId"
and "stacked"."deletedAt" is null
and "stacked"."visibility" = $1
and "stacked"."visibility" = $2
group by
"stacked"."stackId"
) as "stacked_assets" on true
where
"asset"."deletedAt" is null
and "asset"."visibility" in ('archive', 'timeline')
and date_trunc('MONTH', "localDateTime" AT TIME ZONE 'UTC') AT TIME ZONE 'UTC' = $2
and date_trunc('MONTH', "localDateTime" AT TIME ZONE 'UTC') AT TIME ZONE 'UTC' = $3
and not exists (
select
from