fix(server): tighten asset visibility (#18699)

* tighten visibility

* update sql

* elevated access util function

* fix potential sync issue

* include in user stats

* include hidden assets in size usage

* filter visibility in search duplicates query

* stack visibility
This commit is contained in:
Mert
2025-06-02 10:33:08 -04:00
committed by GitHub
parent b5c3a675b2
commit fa22e865a4
21 changed files with 132 additions and 107 deletions

View File

@@ -102,23 +102,23 @@ with
"assets"
inner join "smart_search" on "assets"."id" = "smart_search"."assetId"
where
"assets"."ownerId" = any ($2::uuid[])
"assets"."visibility" in ('archive', 'timeline')
and "assets"."ownerId" = any ($2::uuid[])
and "assets"."deletedAt" is null
and "assets"."visibility" != $3
and "assets"."type" = $4
and "assets"."id" != $5::uuid
and "assets"."type" = $3
and "assets"."id" != $4::uuid
and "assets"."stackId" is null
order by
"distance"
limit
$6
$5
)
select
*
from
"cte"
where
"cte"."distance" <= $7
"cte"."distance" <= $6
commit
-- SearchRepository.searchFaces
@@ -241,7 +241,7 @@ from
inner join "assets" on "assets"."id" = "exif"."assetId"
where
"ownerId" = any ($1::uuid[])
and "visibility" != $2
and "visibility" = $2
and "deletedAt" is null
and "state" is not null
@@ -253,7 +253,7 @@ from
inner join "assets" on "assets"."id" = "exif"."assetId"
where
"ownerId" = any ($1::uuid[])
and "visibility" != $2
and "visibility" = $2
and "deletedAt" is null
and "city" is not null
@@ -265,7 +265,7 @@ from
inner join "assets" on "assets"."id" = "exif"."assetId"
where
"ownerId" = any ($1::uuid[])
and "visibility" != $2
and "visibility" = $2
and "deletedAt" is null
and "make" is not null
@@ -277,6 +277,6 @@ from
inner join "assets" on "assets"."id" = "exif"."assetId"
where
"ownerId" = any ($1::uuid[])
and "visibility" != $2
and "visibility" = $2
and "deletedAt" is null
and "model" is not null