Compare commits

...

5 Commits

Author SHA1 Message Date
Yaros f1ffdfe223 chore: add todos & warning 2026-04-30 19:48:57 +02:00
Yaros 44a77892f4 Merge branch 'main' into fix/map-sidepanel-queries 2026-04-28 19:58:44 +02:00
Yaros 31fb7f6aa8 Merge branch 'main' into fix/map-sidepanel-queries 2026-04-28 19:56:15 +02:00
Yaros 6cd33de1bb fix(server): assets not shown if partner timeline disabled 2026-04-12 13:57:35 +02:00
Yaros ac3eea80d2 fix(server/web): shared albums in map sidebar 2026-04-12 13:36:49 +02:00
7 changed files with 122 additions and 11 deletions
+24 -6
View File
@@ -64,9 +64,12 @@ class TimelineApi {
/// * [bool] withPartners:
/// Include assets shared by partners
///
/// * [bool] withSharedAlbums:
/// Include assets from shared albums
///
/// * [bool] withStacked:
/// Include stacked assets in the response. When true, only primary assets from stacks are returned.
Future<Response> getTimeBucketWithHttpInfo(String timeBucket, { String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withStacked, }) async {
Future<Response> getTimeBucketWithHttpInfo(String timeBucket, { String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withSharedAlbums, bool? withStacked, }) async {
// ignore: prefer_const_declarations
final apiPath = r'/timeline/bucket';
@@ -117,6 +120,9 @@ class TimelineApi {
if (withPartners != null) {
queryParams.addAll(_queryParams('', 'withPartners', withPartners));
}
if (withSharedAlbums != null) {
queryParams.addAll(_queryParams('', 'withSharedAlbums', withSharedAlbums));
}
if (withStacked != null) {
queryParams.addAll(_queryParams('', 'withStacked', withStacked));
}
@@ -181,10 +187,13 @@ class TimelineApi {
/// * [bool] withPartners:
/// Include assets shared by partners
///
/// * [bool] withSharedAlbums:
/// Include assets from shared albums
///
/// * [bool] withStacked:
/// Include stacked assets in the response. When true, only primary assets from stacks are returned.
Future<TimeBucketAssetResponseDto?> getTimeBucket(String timeBucket, { String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withStacked, }) async {
final response = await getTimeBucketWithHttpInfo(timeBucket, albumId: albumId, bbox: bbox, isFavorite: isFavorite, isTrashed: isTrashed, key: key, order: order, personId: personId, slug: slug, tagId: tagId, userId: userId, visibility: visibility, withCoordinates: withCoordinates, withPartners: withPartners, withStacked: withStacked, );
Future<TimeBucketAssetResponseDto?> getTimeBucket(String timeBucket, { String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withSharedAlbums, bool? withStacked, }) async {
final response = await getTimeBucketWithHttpInfo(timeBucket, albumId: albumId, bbox: bbox, isFavorite: isFavorite, isTrashed: isTrashed, key: key, order: order, personId: personId, slug: slug, tagId: tagId, userId: userId, visibility: visibility, withCoordinates: withCoordinates, withPartners: withPartners, withSharedAlbums: withSharedAlbums, withStacked: withStacked, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
@@ -243,9 +252,12 @@ class TimelineApi {
/// * [bool] withPartners:
/// Include assets shared by partners
///
/// * [bool] withSharedAlbums:
/// Include assets from shared albums
///
/// * [bool] withStacked:
/// Include stacked assets in the response. When true, only primary assets from stacks are returned.
Future<Response> getTimeBucketsWithHttpInfo({ String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withStacked, }) async {
Future<Response> getTimeBucketsWithHttpInfo({ String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withSharedAlbums, bool? withStacked, }) async {
// ignore: prefer_const_declarations
final apiPath = r'/timeline/buckets';
@@ -295,6 +307,9 @@ class TimelineApi {
if (withPartners != null) {
queryParams.addAll(_queryParams('', 'withPartners', withPartners));
}
if (withSharedAlbums != null) {
queryParams.addAll(_queryParams('', 'withSharedAlbums', withSharedAlbums));
}
if (withStacked != null) {
queryParams.addAll(_queryParams('', 'withStacked', withStacked));
}
@@ -356,10 +371,13 @@ class TimelineApi {
/// * [bool] withPartners:
/// Include assets shared by partners
///
/// * [bool] withSharedAlbums:
/// Include assets from shared albums
///
/// * [bool] withStacked:
/// Include stacked assets in the response. When true, only primary assets from stacks are returned.
Future<List<TimeBucketsResponseDto>?> getTimeBuckets({ String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withStacked, }) async {
final response = await getTimeBucketsWithHttpInfo( albumId: albumId, bbox: bbox, isFavorite: isFavorite, isTrashed: isTrashed, key: key, order: order, personId: personId, slug: slug, tagId: tagId, userId: userId, visibility: visibility, withCoordinates: withCoordinates, withPartners: withPartners, withStacked: withStacked, );
Future<List<TimeBucketsResponseDto>?> getTimeBuckets({ String? albumId, String? bbox, bool? isFavorite, bool? isTrashed, String? key, AssetOrder? order, String? personId, String? slug, String? tagId, String? userId, AssetVisibility? visibility, bool? withCoordinates, bool? withPartners, bool? withSharedAlbums, bool? withStacked, }) async {
final response = await getTimeBucketsWithHttpInfo( albumId: albumId, bbox: bbox, isFavorite: isFavorite, isTrashed: isTrashed, key: key, order: order, personId: personId, slug: slug, tagId: tagId, userId: userId, visibility: visibility, withCoordinates: withCoordinates, withPartners: withPartners, withSharedAlbums: withSharedAlbums, withStacked: withStacked, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
+18
View File
@@ -13391,6 +13391,15 @@
"type": "boolean"
}
},
{
"name": "withSharedAlbums",
"required": false,
"in": "query",
"description": "Include assets from shared albums",
"schema": {
"type": "boolean"
}
},
{
"name": "withStacked",
"required": false,
@@ -13571,6 +13580,15 @@
"type": "boolean"
}
},
{
"name": "withSharedAlbums",
"required": false,
"in": "query",
"description": "Include assets from shared albums",
"schema": {
"type": "boolean"
}
},
{
"name": "withStacked",
"required": false,
+6 -2
View File
@@ -6286,7 +6286,7 @@ export function tagAssets({ id, bulkIdsDto }: {
/**
* Get time bucket
*/
export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order, personId, slug, tagId, timeBucket, userId, visibility, withCoordinates, withPartners, withStacked }: {
export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order, personId, slug, tagId, timeBucket, userId, visibility, withCoordinates, withPartners, withSharedAlbums, withStacked }: {
albumId?: string;
bbox?: string;
isFavorite?: boolean;
@@ -6301,6 +6301,7 @@ export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order
visibility?: AssetVisibility;
withCoordinates?: boolean;
withPartners?: boolean;
withSharedAlbums?: boolean;
withStacked?: boolean;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
@@ -6321,6 +6322,7 @@ export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order
visibility,
withCoordinates,
withPartners,
withSharedAlbums,
withStacked
}))}`, {
...opts
@@ -6329,7 +6331,7 @@ export function getTimeBucket({ albumId, bbox, isFavorite, isTrashed, key, order
/**
* Get time buckets
*/
export function getTimeBuckets({ albumId, bbox, isFavorite, isTrashed, key, order, personId, slug, tagId, userId, visibility, withCoordinates, withPartners, withStacked }: {
export function getTimeBuckets({ albumId, bbox, isFavorite, isTrashed, key, order, personId, slug, tagId, userId, visibility, withCoordinates, withPartners, withSharedAlbums, withStacked }: {
albumId?: string;
bbox?: string;
isFavorite?: boolean;
@@ -6343,6 +6345,7 @@ export function getTimeBuckets({ albumId, bbox, isFavorite, isTrashed, key, orde
visibility?: AssetVisibility;
withCoordinates?: boolean;
withPartners?: boolean;
withSharedAlbums?: boolean;
withStacked?: boolean;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
@@ -6362,6 +6365,7 @@ export function getTimeBuckets({ albumId, bbox, isFavorite, isTrashed, key, orde
visibility,
withCoordinates,
withPartners,
withSharedAlbums,
withStacked
}))}`, {
...opts
+2
View File
@@ -27,6 +27,8 @@ const TimeBucketQueryBaseSchema = z
'Filter by asset visibility status (ARCHIVE, TIMELINE, HIDDEN, LOCKED)',
),
withCoordinates: stringToBool.optional().describe('Include location data in the response'),
// TODO: Remove this after #12614 is resolved
withSharedAlbums: z.boolean().optional().describe('Include assets from shared albums (do not use!)'),
key: z.string().optional(),
slug: z.string().optional(),
bbox: z
+70 -2
View File
@@ -83,6 +83,7 @@ interface AssetBuilderOptions {
assetType?: AssetType;
visibility?: AssetVisibility;
withCoordinates?: boolean;
withSharedAlbums?: boolean;
bbox?: BoundingBox;
}
@@ -673,7 +674,41 @@ export class AssetRepository {
)
.where((eb) => eb.or([eb('asset.stackId', 'is', null), eb(eb.table('stack'), 'is not', null)])),
)
.$if(!!options.userIds, (qb) => qb.where('asset.ownerId', '=', anyUuid(options.userIds!)))
.$if(!!options.userIds, (qb) =>
qb.where((eb) =>
eb.or([
eb('asset.ownerId', '=', anyUuid(options.userIds!)),
// TODO: Rework, this is inefficient, temporary solution until #12614 is resolved
...(options.withSharedAlbums
? [
eb.exists(
eb
.selectFrom('album_asset')
.innerJoin('album', 'album.id', 'album_asset.albumId')
.whereRef('album_asset.assetId', '=', 'asset.id')
.where((eb) =>
eb.or([
eb('album.ownerId', '=', anyUuid(options.userIds!)),
eb.exists(
eb
.selectFrom('album_user')
.whereRef('album_user.albumId', '=', 'album.id')
.where('album_user.userId', '=', anyUuid(options.userIds!)),
),
eb.exists(
eb
.selectFrom('shared_link')
.whereRef('shared_link.albumId', '=', 'album.id')
.where('shared_link.userId', '=', anyUuid(options.userIds!)),
),
]),
),
),
]
: []),
]),
),
)
.$if(options.isFavorite !== undefined, (qb) => qb.where('asset.isFavorite', '=', options.isFavorite!))
.$if(!!options.assetType, (qb) => qb.where('asset.type', '=', options.assetType!))
.$if(options.isDuplicate !== undefined, (qb) =>
@@ -757,7 +792,40 @@ export class AssetRepository {
),
)
.$if(!!options.personId, (qb) => hasPeople(qb, [options.personId!]))
.$if(!!options.userIds, (qb) => qb.where('asset.ownerId', '=', anyUuid(options.userIds!)))
.$if(!!options.userIds, (qb) =>
qb.where((eb) =>
eb.or([
eb('asset.ownerId', '=', anyUuid(options.userIds!)),
...(options.withSharedAlbums
? [
eb.exists(
eb
.selectFrom('album_asset')
.innerJoin('album', 'album.id', 'album_asset.albumId')
.whereRef('album_asset.assetId', '=', 'asset.id')
.where((eb) =>
eb.or([
eb('album.ownerId', '=', anyUuid(options.userIds!)),
eb.exists(
eb
.selectFrom('album_user')
.whereRef('album_user.albumId', '=', 'album.id')
.where('album_user.userId', '=', anyUuid(options.userIds!)),
),
eb.exists(
eb
.selectFrom('shared_link')
.whereRef('shared_link.albumId', '=', 'album.id')
.where('shared_link.userId', '=', anyUuid(options.userIds!)),
),
]),
),
),
]
: []),
]),
),
)
.$if(options.isFavorite !== undefined, (qb) => qb.where('asset.isFavorite', '=', options.isFavorite!))
.$if(!!options.withStacked, (qb) =>
qb
+1 -1
View File
@@ -35,7 +35,7 @@ export class TimelineService extends BaseService {
const partnerIds = await getMyPartnerIds({
userId: auth.user.id,
repository: this.partnerRepository,
timelineEnabled: true,
timelineEnabled: dto.bbox === undefined, // ignore this option in map view
});
userIds.push(...partnerIds);
}
@@ -85,6 +85,7 @@
visibility: $mapSettings.includeArchived ? undefined : AssetVisibility.Timeline,
isFavorite: $mapSettings.onlyFavorites || undefined,
withPartners: $mapSettings.withPartners || undefined,
withSharedAlbums: $mapSettings.withSharedAlbums || undefined,
assetFilter: selectedClusterIds,
});