mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
feat(web): add a user setting for default album sort order. (#18950)
* Add a user setting for default album sort order. Add a user setting under "Features" to control the initial sort order when creating an album. Default to the existing behavior of "newest first". * chore: patch openapi --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
55f4e93456
commit
b46e066cc2
@ -402,6 +402,9 @@
|
|||||||
"album_with_link_access": "Let anyone with the link see photos and people in this album.",
|
"album_with_link_access": "Let anyone with the link see photos and people in this album.",
|
||||||
"albums": "Albums",
|
"albums": "Albums",
|
||||||
"albums_count": "{count, plural, one {{count, number} Album} other {{count, number} Albums}}",
|
"albums_count": "{count, plural, one {{count, number} Album} other {{count, number} Albums}}",
|
||||||
|
"albums_default_sort_order": "Default album sort order",
|
||||||
|
"albums_default_sort_order_description": "Initial asset sort order when creating new albums.",
|
||||||
|
"albums_feature_description": "Collections of assets that can be shared with other users.",
|
||||||
"all": "All",
|
"all": "All",
|
||||||
"all_albums": "All albums",
|
"all_albums": "All albums",
|
||||||
"all_people": "All people",
|
"all_people": "All people",
|
||||||
|
@ -12,6 +12,7 @@ dynamic upgradeDto(dynamic value, String targetType) {
|
|||||||
addDefault(value, 'tags', TagsResponse().toJson());
|
addDefault(value, 'tags', TagsResponse().toJson());
|
||||||
addDefault(value, 'sharedLinks', SharedLinksResponse().toJson());
|
addDefault(value, 'sharedLinks', SharedLinksResponse().toJson());
|
||||||
addDefault(value, 'cast', CastResponse().toJson());
|
addDefault(value, 'cast', CastResponse().toJson());
|
||||||
|
addDefault(value, 'albums', {'defaultAssetOrder': 'desc'});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'ServerConfigDto':
|
case 'ServerConfigDto':
|
||||||
|
2
mobile/openapi/README.md
generated
2
mobile/openapi/README.md
generated
@ -289,6 +289,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [AlbumUserCreateDto](doc//AlbumUserCreateDto.md)
|
- [AlbumUserCreateDto](doc//AlbumUserCreateDto.md)
|
||||||
- [AlbumUserResponseDto](doc//AlbumUserResponseDto.md)
|
- [AlbumUserResponseDto](doc//AlbumUserResponseDto.md)
|
||||||
- [AlbumUserRole](doc//AlbumUserRole.md)
|
- [AlbumUserRole](doc//AlbumUserRole.md)
|
||||||
|
- [AlbumsResponse](doc//AlbumsResponse.md)
|
||||||
|
- [AlbumsUpdate](doc//AlbumsUpdate.md)
|
||||||
- [AllJobStatusResponseDto](doc//AllJobStatusResponseDto.md)
|
- [AllJobStatusResponseDto](doc//AllJobStatusResponseDto.md)
|
||||||
- [AssetBulkDeleteDto](doc//AssetBulkDeleteDto.md)
|
- [AssetBulkDeleteDto](doc//AssetBulkDeleteDto.md)
|
||||||
- [AssetBulkUpdateDto](doc//AssetBulkUpdateDto.md)
|
- [AssetBulkUpdateDto](doc//AssetBulkUpdateDto.md)
|
||||||
|
2
mobile/openapi/lib/api.dart
generated
2
mobile/openapi/lib/api.dart
generated
@ -78,6 +78,8 @@ part 'model/album_user_add_dto.dart';
|
|||||||
part 'model/album_user_create_dto.dart';
|
part 'model/album_user_create_dto.dart';
|
||||||
part 'model/album_user_response_dto.dart';
|
part 'model/album_user_response_dto.dart';
|
||||||
part 'model/album_user_role.dart';
|
part 'model/album_user_role.dart';
|
||||||
|
part 'model/albums_response.dart';
|
||||||
|
part 'model/albums_update.dart';
|
||||||
part 'model/all_job_status_response_dto.dart';
|
part 'model/all_job_status_response_dto.dart';
|
||||||
part 'model/asset_bulk_delete_dto.dart';
|
part 'model/asset_bulk_delete_dto.dart';
|
||||||
part 'model/asset_bulk_update_dto.dart';
|
part 'model/asset_bulk_update_dto.dart';
|
||||||
|
4
mobile/openapi/lib/api_client.dart
generated
4
mobile/openapi/lib/api_client.dart
generated
@ -212,6 +212,10 @@ class ApiClient {
|
|||||||
return AlbumUserResponseDto.fromJson(value);
|
return AlbumUserResponseDto.fromJson(value);
|
||||||
case 'AlbumUserRole':
|
case 'AlbumUserRole':
|
||||||
return AlbumUserRoleTypeTransformer().decode(value);
|
return AlbumUserRoleTypeTransformer().decode(value);
|
||||||
|
case 'AlbumsResponse':
|
||||||
|
return AlbumsResponse.fromJson(value);
|
||||||
|
case 'AlbumsUpdate':
|
||||||
|
return AlbumsUpdate.fromJson(value);
|
||||||
case 'AllJobStatusResponseDto':
|
case 'AllJobStatusResponseDto':
|
||||||
return AllJobStatusResponseDto.fromJson(value);
|
return AllJobStatusResponseDto.fromJson(value);
|
||||||
case 'AssetBulkDeleteDto':
|
case 'AssetBulkDeleteDto':
|
||||||
|
99
mobile/openapi/lib/model/albums_response.dart
generated
Normal file
99
mobile/openapi/lib/model/albums_response.dart
generated
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class AlbumsResponse {
|
||||||
|
/// Returns a new [AlbumsResponse] instance.
|
||||||
|
AlbumsResponse({
|
||||||
|
this.defaultAssetOrder = AssetOrder.desc,
|
||||||
|
});
|
||||||
|
|
||||||
|
AssetOrder defaultAssetOrder;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is AlbumsResponse &&
|
||||||
|
other.defaultAssetOrder == defaultAssetOrder;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(defaultAssetOrder.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'AlbumsResponse[defaultAssetOrder=$defaultAssetOrder]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
json[r'defaultAssetOrder'] = this.defaultAssetOrder;
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [AlbumsResponse] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static AlbumsResponse? fromJson(dynamic value) {
|
||||||
|
upgradeDto(value, "AlbumsResponse");
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
return AlbumsResponse(
|
||||||
|
defaultAssetOrder: AssetOrder.fromJson(json[r'defaultAssetOrder'])!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<AlbumsResponse> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <AlbumsResponse>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = AlbumsResponse.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, AlbumsResponse> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, AlbumsResponse>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = AlbumsResponse.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of AlbumsResponse-objects as value to a dart map
|
||||||
|
static Map<String, List<AlbumsResponse>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<AlbumsResponse>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = AlbumsResponse.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
'defaultAssetOrder',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
108
mobile/openapi/lib/model/albums_update.dart
generated
Normal file
108
mobile/openapi/lib/model/albums_update.dart
generated
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class AlbumsUpdate {
|
||||||
|
/// Returns a new [AlbumsUpdate] instance.
|
||||||
|
AlbumsUpdate({
|
||||||
|
this.defaultAssetOrder,
|
||||||
|
});
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Please note: This property should have been non-nullable! Since the specification file
|
||||||
|
/// does not include a default value (using the "default:" property), however, the generated
|
||||||
|
/// source code must fall back to having a nullable type.
|
||||||
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||||
|
///
|
||||||
|
AssetOrder? defaultAssetOrder;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is AlbumsUpdate &&
|
||||||
|
other.defaultAssetOrder == defaultAssetOrder;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(defaultAssetOrder == null ? 0 : defaultAssetOrder!.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'AlbumsUpdate[defaultAssetOrder=$defaultAssetOrder]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
if (this.defaultAssetOrder != null) {
|
||||||
|
json[r'defaultAssetOrder'] = this.defaultAssetOrder;
|
||||||
|
} else {
|
||||||
|
// json[r'defaultAssetOrder'] = null;
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [AlbumsUpdate] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static AlbumsUpdate? fromJson(dynamic value) {
|
||||||
|
upgradeDto(value, "AlbumsUpdate");
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
return AlbumsUpdate(
|
||||||
|
defaultAssetOrder: AssetOrder.fromJson(json[r'defaultAssetOrder']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<AlbumsUpdate> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <AlbumsUpdate>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = AlbumsUpdate.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, AlbumsUpdate> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, AlbumsUpdate>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = AlbumsUpdate.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of AlbumsUpdate-objects as value to a dart map
|
||||||
|
static Map<String, List<AlbumsUpdate>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<AlbumsUpdate>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = AlbumsUpdate.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,7 @@ part of openapi.api;
|
|||||||
class UserPreferencesResponseDto {
|
class UserPreferencesResponseDto {
|
||||||
/// Returns a new [UserPreferencesResponseDto] instance.
|
/// Returns a new [UserPreferencesResponseDto] instance.
|
||||||
UserPreferencesResponseDto({
|
UserPreferencesResponseDto({
|
||||||
|
required this.albums,
|
||||||
required this.cast,
|
required this.cast,
|
||||||
required this.download,
|
required this.download,
|
||||||
required this.emailNotifications,
|
required this.emailNotifications,
|
||||||
@ -25,6 +26,8 @@ class UserPreferencesResponseDto {
|
|||||||
required this.tags,
|
required this.tags,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AlbumsResponse albums;
|
||||||
|
|
||||||
CastResponse cast;
|
CastResponse cast;
|
||||||
|
|
||||||
DownloadResponse download;
|
DownloadResponse download;
|
||||||
@ -47,6 +50,7 @@ class UserPreferencesResponseDto {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesResponseDto &&
|
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesResponseDto &&
|
||||||
|
other.albums == albums &&
|
||||||
other.cast == cast &&
|
other.cast == cast &&
|
||||||
other.download == download &&
|
other.download == download &&
|
||||||
other.emailNotifications == emailNotifications &&
|
other.emailNotifications == emailNotifications &&
|
||||||
@ -61,6 +65,7 @@ class UserPreferencesResponseDto {
|
|||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
// ignore: unnecessary_parenthesis
|
// ignore: unnecessary_parenthesis
|
||||||
|
(albums.hashCode) +
|
||||||
(cast.hashCode) +
|
(cast.hashCode) +
|
||||||
(download.hashCode) +
|
(download.hashCode) +
|
||||||
(emailNotifications.hashCode) +
|
(emailNotifications.hashCode) +
|
||||||
@ -73,10 +78,11 @@ class UserPreferencesResponseDto {
|
|||||||
(tags.hashCode);
|
(tags.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'UserPreferencesResponseDto[cast=$cast, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
|
String toString() => 'UserPreferencesResponseDto[albums=$albums, cast=$cast, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
|
json[r'albums'] = this.albums;
|
||||||
json[r'cast'] = this.cast;
|
json[r'cast'] = this.cast;
|
||||||
json[r'download'] = this.download;
|
json[r'download'] = this.download;
|
||||||
json[r'emailNotifications'] = this.emailNotifications;
|
json[r'emailNotifications'] = this.emailNotifications;
|
||||||
@ -99,6 +105,7 @@ class UserPreferencesResponseDto {
|
|||||||
final json = value.cast<String, dynamic>();
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
return UserPreferencesResponseDto(
|
return UserPreferencesResponseDto(
|
||||||
|
albums: AlbumsResponse.fromJson(json[r'albums'])!,
|
||||||
cast: CastResponse.fromJson(json[r'cast'])!,
|
cast: CastResponse.fromJson(json[r'cast'])!,
|
||||||
download: DownloadResponse.fromJson(json[r'download'])!,
|
download: DownloadResponse.fromJson(json[r'download'])!,
|
||||||
emailNotifications: EmailNotificationsResponse.fromJson(json[r'emailNotifications'])!,
|
emailNotifications: EmailNotificationsResponse.fromJson(json[r'emailNotifications'])!,
|
||||||
@ -156,6 +163,7 @@ class UserPreferencesResponseDto {
|
|||||||
|
|
||||||
/// The list of required keys that must be present in a JSON.
|
/// The list of required keys that must be present in a JSON.
|
||||||
static const requiredKeys = <String>{
|
static const requiredKeys = <String>{
|
||||||
|
'albums',
|
||||||
'cast',
|
'cast',
|
||||||
'download',
|
'download',
|
||||||
'emailNotifications',
|
'emailNotifications',
|
||||||
|
@ -13,6 +13,7 @@ part of openapi.api;
|
|||||||
class UserPreferencesUpdateDto {
|
class UserPreferencesUpdateDto {
|
||||||
/// Returns a new [UserPreferencesUpdateDto] instance.
|
/// Returns a new [UserPreferencesUpdateDto] instance.
|
||||||
UserPreferencesUpdateDto({
|
UserPreferencesUpdateDto({
|
||||||
|
this.albums,
|
||||||
this.avatar,
|
this.avatar,
|
||||||
this.cast,
|
this.cast,
|
||||||
this.download,
|
this.download,
|
||||||
@ -26,6 +27,14 @@ class UserPreferencesUpdateDto {
|
|||||||
this.tags,
|
this.tags,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Please note: This property should have been non-nullable! Since the specification file
|
||||||
|
/// does not include a default value (using the "default:" property), however, the generated
|
||||||
|
/// source code must fall back to having a nullable type.
|
||||||
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||||
|
///
|
||||||
|
AlbumsUpdate? albums;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Please note: This property should have been non-nullable! Since the specification file
|
/// Please note: This property should have been non-nullable! Since the specification file
|
||||||
/// does not include a default value (using the "default:" property), however, the generated
|
/// does not include a default value (using the "default:" property), however, the generated
|
||||||
@ -116,6 +125,7 @@ class UserPreferencesUpdateDto {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesUpdateDto &&
|
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesUpdateDto &&
|
||||||
|
other.albums == albums &&
|
||||||
other.avatar == avatar &&
|
other.avatar == avatar &&
|
||||||
other.cast == cast &&
|
other.cast == cast &&
|
||||||
other.download == download &&
|
other.download == download &&
|
||||||
@ -131,6 +141,7 @@ class UserPreferencesUpdateDto {
|
|||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
// ignore: unnecessary_parenthesis
|
// ignore: unnecessary_parenthesis
|
||||||
|
(albums == null ? 0 : albums!.hashCode) +
|
||||||
(avatar == null ? 0 : avatar!.hashCode) +
|
(avatar == null ? 0 : avatar!.hashCode) +
|
||||||
(cast == null ? 0 : cast!.hashCode) +
|
(cast == null ? 0 : cast!.hashCode) +
|
||||||
(download == null ? 0 : download!.hashCode) +
|
(download == null ? 0 : download!.hashCode) +
|
||||||
@ -144,10 +155,15 @@ class UserPreferencesUpdateDto {
|
|||||||
(tags == null ? 0 : tags!.hashCode);
|
(tags == null ? 0 : tags!.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, cast=$cast, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
|
String toString() => 'UserPreferencesUpdateDto[albums=$albums, avatar=$avatar, cast=$cast, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
|
if (this.albums != null) {
|
||||||
|
json[r'albums'] = this.albums;
|
||||||
|
} else {
|
||||||
|
// json[r'albums'] = null;
|
||||||
|
}
|
||||||
if (this.avatar != null) {
|
if (this.avatar != null) {
|
||||||
json[r'avatar'] = this.avatar;
|
json[r'avatar'] = this.avatar;
|
||||||
} else {
|
} else {
|
||||||
@ -215,6 +231,7 @@ class UserPreferencesUpdateDto {
|
|||||||
final json = value.cast<String, dynamic>();
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
return UserPreferencesUpdateDto(
|
return UserPreferencesUpdateDto(
|
||||||
|
albums: AlbumsUpdate.fromJson(json[r'albums']),
|
||||||
avatar: AvatarUpdate.fromJson(json[r'avatar']),
|
avatar: AvatarUpdate.fromJson(json[r'avatar']),
|
||||||
cast: CastUpdate.fromJson(json[r'cast']),
|
cast: CastUpdate.fromJson(json[r'cast']),
|
||||||
download: DownloadUpdate.fromJson(json[r'download']),
|
download: DownloadUpdate.fromJson(json[r'download']),
|
||||||
|
@ -8717,6 +8717,34 @@
|
|||||||
],
|
],
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"AlbumsResponse": {
|
||||||
|
"properties": {
|
||||||
|
"defaultAssetOrder": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/AssetOrder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": "desc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"defaultAssetOrder"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"AlbumsUpdate": {
|
||||||
|
"properties": {
|
||||||
|
"defaultAssetOrder": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/AssetOrder"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"AllJobStatusResponseDto": {
|
"AllJobStatusResponseDto": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"backgroundTask": {
|
"backgroundTask": {
|
||||||
@ -15040,6 +15068,9 @@
|
|||||||
},
|
},
|
||||||
"UserPreferencesResponseDto": {
|
"UserPreferencesResponseDto": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"albums": {
|
||||||
|
"$ref": "#/components/schemas/AlbumsResponse"
|
||||||
|
},
|
||||||
"cast": {
|
"cast": {
|
||||||
"$ref": "#/components/schemas/CastResponse"
|
"$ref": "#/components/schemas/CastResponse"
|
||||||
},
|
},
|
||||||
@ -15072,6 +15103,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
"albums",
|
||||||
"cast",
|
"cast",
|
||||||
"download",
|
"download",
|
||||||
"emailNotifications",
|
"emailNotifications",
|
||||||
@ -15087,6 +15119,9 @@
|
|||||||
},
|
},
|
||||||
"UserPreferencesUpdateDto": {
|
"UserPreferencesUpdateDto": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"albums": {
|
||||||
|
"$ref": "#/components/schemas/AlbumsUpdate"
|
||||||
|
},
|
||||||
"avatar": {
|
"avatar": {
|
||||||
"$ref": "#/components/schemas/AvatarUpdate"
|
"$ref": "#/components/schemas/AvatarUpdate"
|
||||||
},
|
},
|
||||||
|
@ -129,6 +129,9 @@ export type UserAdminUpdateDto = {
|
|||||||
shouldChangePassword?: boolean;
|
shouldChangePassword?: boolean;
|
||||||
storageLabel?: string | null;
|
storageLabel?: string | null;
|
||||||
};
|
};
|
||||||
|
export type AlbumsResponse = {
|
||||||
|
defaultAssetOrder: AssetOrder;
|
||||||
|
};
|
||||||
export type CastResponse = {
|
export type CastResponse = {
|
||||||
gCastEnabled: boolean;
|
gCastEnabled: boolean;
|
||||||
};
|
};
|
||||||
@ -168,6 +171,7 @@ export type TagsResponse = {
|
|||||||
sidebarWeb: boolean;
|
sidebarWeb: boolean;
|
||||||
};
|
};
|
||||||
export type UserPreferencesResponseDto = {
|
export type UserPreferencesResponseDto = {
|
||||||
|
albums: AlbumsResponse;
|
||||||
cast: CastResponse;
|
cast: CastResponse;
|
||||||
download: DownloadResponse;
|
download: DownloadResponse;
|
||||||
emailNotifications: EmailNotificationsResponse;
|
emailNotifications: EmailNotificationsResponse;
|
||||||
@ -179,6 +183,9 @@ export type UserPreferencesResponseDto = {
|
|||||||
sharedLinks: SharedLinksResponse;
|
sharedLinks: SharedLinksResponse;
|
||||||
tags: TagsResponse;
|
tags: TagsResponse;
|
||||||
};
|
};
|
||||||
|
export type AlbumsUpdate = {
|
||||||
|
defaultAssetOrder?: AssetOrder;
|
||||||
|
};
|
||||||
export type AvatarUpdate = {
|
export type AvatarUpdate = {
|
||||||
color?: UserAvatarColor;
|
color?: UserAvatarColor;
|
||||||
};
|
};
|
||||||
@ -221,6 +228,7 @@ export type TagsUpdate = {
|
|||||||
sidebarWeb?: boolean;
|
sidebarWeb?: boolean;
|
||||||
};
|
};
|
||||||
export type UserPreferencesUpdateDto = {
|
export type UserPreferencesUpdateDto = {
|
||||||
|
albums?: AlbumsUpdate;
|
||||||
avatar?: AvatarUpdate;
|
avatar?: AvatarUpdate;
|
||||||
cast?: CastUpdate;
|
cast?: CastUpdate;
|
||||||
download?: DownloadUpdate;
|
download?: DownloadUpdate;
|
||||||
@ -3749,6 +3757,10 @@ export enum UserStatus {
|
|||||||
Removing = "removing",
|
Removing = "removing",
|
||||||
Deleted = "deleted"
|
Deleted = "deleted"
|
||||||
}
|
}
|
||||||
|
export enum AssetOrder {
|
||||||
|
Asc = "asc",
|
||||||
|
Desc = "desc"
|
||||||
|
}
|
||||||
export enum AssetVisibility {
|
export enum AssetVisibility {
|
||||||
Archive = "archive",
|
Archive = "archive",
|
||||||
Timeline = "timeline",
|
Timeline = "timeline",
|
||||||
@ -3770,10 +3782,6 @@ export enum AssetTypeEnum {
|
|||||||
Audio = "AUDIO",
|
Audio = "AUDIO",
|
||||||
Other = "OTHER"
|
Other = "OTHER"
|
||||||
}
|
}
|
||||||
export enum AssetOrder {
|
|
||||||
Asc = "asc",
|
|
||||||
Desc = "desc"
|
|
||||||
}
|
|
||||||
export enum Error {
|
export enum Error {
|
||||||
Duplicate = "duplicate",
|
Duplicate = "duplicate",
|
||||||
NoPermission = "no_permission",
|
NoPermission = "no_permission",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Type } from 'class-transformer';
|
import { Type } from 'class-transformer';
|
||||||
import { IsDateString, IsEnum, IsInt, IsPositive, ValidateNested } from 'class-validator';
|
import { IsDateString, IsEnum, IsInt, IsPositive, ValidateNested } from 'class-validator';
|
||||||
import { UserAvatarColor } from 'src/enum';
|
import { AssetOrder, UserAvatarColor } from 'src/enum';
|
||||||
import { UserPreferences } from 'src/types';
|
import { UserPreferences } from 'src/types';
|
||||||
import { Optional, ValidateBoolean } from 'src/validation';
|
import { Optional, ValidateBoolean } from 'src/validation';
|
||||||
|
|
||||||
@ -22,6 +22,12 @@ class RatingsUpdate {
|
|||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AlbumsUpdate {
|
||||||
|
@IsEnum(AssetOrder)
|
||||||
|
@ApiProperty({ enumName: 'AssetOrder', enum: AssetOrder })
|
||||||
|
defaultAssetOrder?: AssetOrder;
|
||||||
|
}
|
||||||
|
|
||||||
class FoldersUpdate {
|
class FoldersUpdate {
|
||||||
@ValidateBoolean({ optional: true })
|
@ValidateBoolean({ optional: true })
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
@ -91,6 +97,11 @@ class CastUpdate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class UserPreferencesUpdateDto {
|
export class UserPreferencesUpdateDto {
|
||||||
|
@Optional()
|
||||||
|
@ValidateNested()
|
||||||
|
@Type(() => AlbumsUpdate)
|
||||||
|
albums?: AlbumsUpdate;
|
||||||
|
|
||||||
@Optional()
|
@Optional()
|
||||||
@ValidateNested()
|
@ValidateNested()
|
||||||
@Type(() => FoldersUpdate)
|
@Type(() => FoldersUpdate)
|
||||||
@ -147,6 +158,12 @@ export class UserPreferencesUpdateDto {
|
|||||||
cast?: CastUpdate;
|
cast?: CastUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AlbumsResponse {
|
||||||
|
@IsEnum(AssetOrder)
|
||||||
|
@ApiProperty({ enumName: 'AssetOrder', enum: AssetOrder })
|
||||||
|
defaultAssetOrder: AssetOrder = AssetOrder.DESC;
|
||||||
|
}
|
||||||
|
|
||||||
class RatingsResponse {
|
class RatingsResponse {
|
||||||
enabled: boolean = false;
|
enabled: boolean = false;
|
||||||
}
|
}
|
||||||
@ -198,6 +215,7 @@ class CastResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class UserPreferencesResponseDto implements UserPreferences {
|
export class UserPreferencesResponseDto implements UserPreferences {
|
||||||
|
albums!: AlbumsResponse;
|
||||||
folders!: FoldersResponse;
|
folders!: FoldersResponse;
|
||||||
memories!: MemoriesResponse;
|
memories!: MemoriesResponse;
|
||||||
people!: PeopleResponse;
|
people!: PeopleResponse;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { BadRequestException } from '@nestjs/common';
|
import { BadRequestException } from '@nestjs/common';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { BulkIdErrorReason } from 'src/dtos/asset-ids.response.dto';
|
import { BulkIdErrorReason } from 'src/dtos/asset-ids.response.dto';
|
||||||
import { AlbumUserRole } from 'src/enum';
|
import { AlbumUserRole, AssetOrder, UserMetadataKey } from 'src/enum';
|
||||||
import { AlbumService } from 'src/services/album.service';
|
import { AlbumService } from 'src/services/album.service';
|
||||||
import { albumStub } from 'test/fixtures/album.stub';
|
import { albumStub } from 'test/fixtures/album.stub';
|
||||||
import { authStub } from 'test/fixtures/auth.stub';
|
import { authStub } from 'test/fixtures/auth.stub';
|
||||||
@ -141,6 +141,7 @@ describe(AlbumService.name, () => {
|
|||||||
it('creates album', async () => {
|
it('creates album', async () => {
|
||||||
mocks.album.create.mockResolvedValue(albumStub.empty);
|
mocks.album.create.mockResolvedValue(albumStub.empty);
|
||||||
mocks.user.get.mockResolvedValue(userStub.user1);
|
mocks.user.get.mockResolvedValue(userStub.user1);
|
||||||
|
mocks.user.getMetadata.mockResolvedValue([]);
|
||||||
mocks.access.asset.checkOwnerAccess.mockResolvedValue(new Set(['123']));
|
mocks.access.asset.checkOwnerAccess.mockResolvedValue(new Set(['123']));
|
||||||
|
|
||||||
await sut.create(authStub.admin, {
|
await sut.create(authStub.admin, {
|
||||||
@ -155,7 +156,7 @@ describe(AlbumService.name, () => {
|
|||||||
ownerId: authStub.admin.user.id,
|
ownerId: authStub.admin.user.id,
|
||||||
albumName: albumStub.empty.albumName,
|
albumName: albumStub.empty.albumName,
|
||||||
description: albumStub.empty.description,
|
description: albumStub.empty.description,
|
||||||
|
order: 'desc',
|
||||||
albumThumbnailAssetId: '123',
|
albumThumbnailAssetId: '123',
|
||||||
},
|
},
|
||||||
['123'],
|
['123'],
|
||||||
@ -163,6 +164,50 @@ describe(AlbumService.name, () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(mocks.user.get).toHaveBeenCalledWith('user-id', {});
|
expect(mocks.user.get).toHaveBeenCalledWith('user-id', {});
|
||||||
|
expect(mocks.user.getMetadata).toHaveBeenCalledWith(authStub.admin.user.id);
|
||||||
|
expect(mocks.access.asset.checkOwnerAccess).toHaveBeenCalledWith(authStub.admin.user.id, new Set(['123']), false);
|
||||||
|
expect(mocks.event.emit).toHaveBeenCalledWith('album.invite', {
|
||||||
|
id: albumStub.empty.id,
|
||||||
|
userId: 'user-id',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('creates album with assetOrder from user preferences', async () => {
|
||||||
|
mocks.album.create.mockResolvedValue(albumStub.empty);
|
||||||
|
mocks.user.get.mockResolvedValue(userStub.user1);
|
||||||
|
mocks.user.getMetadata.mockResolvedValue([
|
||||||
|
{
|
||||||
|
key: UserMetadataKey.PREFERENCES,
|
||||||
|
value: {
|
||||||
|
albums: {
|
||||||
|
defaultAssetOrder: AssetOrder.ASC,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
mocks.access.asset.checkOwnerAccess.mockResolvedValue(new Set(['123']));
|
||||||
|
|
||||||
|
await sut.create(authStub.admin, {
|
||||||
|
albumName: 'Empty album',
|
||||||
|
albumUsers: [{ userId: 'user-id', role: AlbumUserRole.EDITOR }],
|
||||||
|
description: '',
|
||||||
|
assetIds: ['123'],
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mocks.album.create).toHaveBeenCalledWith(
|
||||||
|
{
|
||||||
|
ownerId: authStub.admin.user.id,
|
||||||
|
albumName: albumStub.empty.albumName,
|
||||||
|
description: albumStub.empty.description,
|
||||||
|
order: 'asc',
|
||||||
|
albumThumbnailAssetId: '123',
|
||||||
|
},
|
||||||
|
['123'],
|
||||||
|
[{ userId: 'user-id', role: AlbumUserRole.EDITOR }],
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(mocks.user.get).toHaveBeenCalledWith('user-id', {});
|
||||||
|
expect(mocks.user.getMetadata).toHaveBeenCalledWith(authStub.admin.user.id);
|
||||||
expect(mocks.access.asset.checkOwnerAccess).toHaveBeenCalledWith(authStub.admin.user.id, new Set(['123']), false);
|
expect(mocks.access.asset.checkOwnerAccess).toHaveBeenCalledWith(authStub.admin.user.id, new Set(['123']), false);
|
||||||
expect(mocks.event.emit).toHaveBeenCalledWith('album.invite', {
|
expect(mocks.event.emit).toHaveBeenCalledWith('album.invite', {
|
||||||
id: albumStub.empty.id,
|
id: albumStub.empty.id,
|
||||||
@ -185,6 +230,7 @@ describe(AlbumService.name, () => {
|
|||||||
it('should only add assets the user is allowed to access', async () => {
|
it('should only add assets the user is allowed to access', async () => {
|
||||||
mocks.user.get.mockResolvedValue(userStub.user1);
|
mocks.user.get.mockResolvedValue(userStub.user1);
|
||||||
mocks.album.create.mockResolvedValue(albumStub.oneAsset);
|
mocks.album.create.mockResolvedValue(albumStub.oneAsset);
|
||||||
|
mocks.user.getMetadata.mockResolvedValue([]);
|
||||||
mocks.access.asset.checkOwnerAccess.mockResolvedValue(new Set(['asset-1']));
|
mocks.access.asset.checkOwnerAccess.mockResolvedValue(new Set(['asset-1']));
|
||||||
|
|
||||||
await sut.create(authStub.admin, {
|
await sut.create(authStub.admin, {
|
||||||
@ -198,7 +244,7 @@ describe(AlbumService.name, () => {
|
|||||||
ownerId: authStub.admin.user.id,
|
ownerId: authStub.admin.user.id,
|
||||||
albumName: 'Test album',
|
albumName: 'Test album',
|
||||||
description: '',
|
description: '',
|
||||||
|
order: 'desc',
|
||||||
albumThumbnailAssetId: 'asset-1',
|
albumThumbnailAssetId: 'asset-1',
|
||||||
},
|
},
|
||||||
['asset-1'],
|
['asset-1'],
|
||||||
|
@ -19,6 +19,7 @@ import { Permission } from 'src/enum';
|
|||||||
import { AlbumAssetCount, AlbumInfoOptions } from 'src/repositories/album.repository';
|
import { AlbumAssetCount, AlbumInfoOptions } from 'src/repositories/album.repository';
|
||||||
import { BaseService } from 'src/services/base.service';
|
import { BaseService } from 'src/services/base.service';
|
||||||
import { addAssets, removeAssets } from 'src/utils/asset.util';
|
import { addAssets, removeAssets } from 'src/utils/asset.util';
|
||||||
|
import { getPreferences } from 'src/utils/preferences';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlbumService extends BaseService {
|
export class AlbumService extends BaseService {
|
||||||
@ -106,12 +107,15 @@ export class AlbumService extends BaseService {
|
|||||||
});
|
});
|
||||||
const assetIds = [...allowedAssetIdsSet].map((id) => id);
|
const assetIds = [...allowedAssetIdsSet].map((id) => id);
|
||||||
|
|
||||||
|
const userMetadata = await this.userRepository.getMetadata(auth.user.id);
|
||||||
|
|
||||||
const album = await this.albumRepository.create(
|
const album = await this.albumRepository.create(
|
||||||
{
|
{
|
||||||
ownerId: auth.user.id,
|
ownerId: auth.user.id,
|
||||||
albumName: dto.albumName,
|
albumName: dto.albumName,
|
||||||
description: dto.description,
|
description: dto.description,
|
||||||
albumThumbnailAssetId: assetIds[0] || null,
|
albumThumbnailAssetId: assetIds[0] || null,
|
||||||
|
order: getPreferences(userMetadata).albums.defaultAssetOrder,
|
||||||
},
|
},
|
||||||
assetIds,
|
assetIds,
|
||||||
albumUsers,
|
albumUsers,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { SystemConfig } from 'src/config';
|
import { SystemConfig } from 'src/config';
|
||||||
import { VECTOR_EXTENSIONS } from 'src/constants';
|
import { VECTOR_EXTENSIONS } from 'src/constants';
|
||||||
import {
|
import {
|
||||||
|
AssetOrder,
|
||||||
AssetType,
|
AssetType,
|
||||||
DatabaseSslMode,
|
DatabaseSslMode,
|
||||||
ExifOrientation,
|
ExifOrientation,
|
||||||
@ -467,6 +468,9 @@ export type UserMetadataItem<T extends keyof UserMetadata = UserMetadataKey> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export interface UserPreferences {
|
export interface UserPreferences {
|
||||||
|
albums: {
|
||||||
|
defaultAssetOrder: AssetOrder;
|
||||||
|
};
|
||||||
folders: {
|
folders: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
sidebarWeb: boolean;
|
sidebarWeb: boolean;
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { UserPreferencesUpdateDto } from 'src/dtos/user-preferences.dto';
|
import { UserPreferencesUpdateDto } from 'src/dtos/user-preferences.dto';
|
||||||
import { UserMetadataKey } from 'src/enum';
|
import { AssetOrder, UserMetadataKey } from 'src/enum';
|
||||||
import { DeepPartial, UserMetadataItem, UserPreferences } from 'src/types';
|
import { DeepPartial, UserMetadataItem, UserPreferences } from 'src/types';
|
||||||
import { HumanReadableSize } from 'src/utils/bytes';
|
import { HumanReadableSize } from 'src/utils/bytes';
|
||||||
import { getKeysDeep } from 'src/utils/misc';
|
import { getKeysDeep } from 'src/utils/misc';
|
||||||
|
|
||||||
const getDefaultPreferences = (): UserPreferences => {
|
const getDefaultPreferences = (): UserPreferences => {
|
||||||
return {
|
return {
|
||||||
|
albums: {
|
||||||
|
defaultAssetOrder: AssetOrder.DESC,
|
||||||
|
},
|
||||||
folders: {
|
folders: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
sidebarWeb: false,
|
sidebarWeb: false,
|
||||||
|
@ -4,14 +4,18 @@
|
|||||||
NotificationType,
|
NotificationType,
|
||||||
} from '$lib/components/shared-components/notification/notification';
|
} from '$lib/components/shared-components/notification/notification';
|
||||||
import SettingAccordion from '$lib/components/shared-components/settings/setting-accordion.svelte';
|
import SettingAccordion from '$lib/components/shared-components/settings/setting-accordion.svelte';
|
||||||
|
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
||||||
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
||||||
import { preferences } from '$lib/stores/user.store';
|
import { preferences } from '$lib/stores/user.store';
|
||||||
import { updateMyPreferences } from '@immich/sdk';
|
import { AssetOrder, updateMyPreferences } from '@immich/sdk';
|
||||||
import { Button } from '@immich/ui';
|
import { Button } from '@immich/ui';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import { handleError } from '../../utils/handle-error';
|
import { handleError } from '../../utils/handle-error';
|
||||||
|
|
||||||
|
// Albums
|
||||||
|
let defaultAssetOrder = $state($preferences?.albums?.defaultAssetOrder ?? AssetOrder.Desc);
|
||||||
|
|
||||||
// Folders
|
// Folders
|
||||||
let foldersEnabled = $state($preferences?.folders?.enabled ?? false);
|
let foldersEnabled = $state($preferences?.folders?.enabled ?? false);
|
||||||
let foldersSidebar = $state($preferences?.folders?.sidebarWeb ?? false);
|
let foldersSidebar = $state($preferences?.folders?.sidebarWeb ?? false);
|
||||||
@ -41,6 +45,7 @@
|
|||||||
try {
|
try {
|
||||||
const data = await updateMyPreferences({
|
const data = await updateMyPreferences({
|
||||||
userPreferencesUpdateDto: {
|
userPreferencesUpdateDto: {
|
||||||
|
albums: { defaultAssetOrder },
|
||||||
folders: { enabled: foldersEnabled, sidebarWeb: foldersSidebar },
|
folders: { enabled: foldersEnabled, sidebarWeb: foldersSidebar },
|
||||||
memories: { enabled: memoriesEnabled },
|
memories: { enabled: memoriesEnabled },
|
||||||
people: { enabled: peopleEnabled, sidebarWeb: peopleSidebar },
|
people: { enabled: peopleEnabled, sidebarWeb: peopleSidebar },
|
||||||
@ -68,6 +73,20 @@
|
|||||||
<div in:fade={{ duration: 500 }}>
|
<div in:fade={{ duration: 500 }}>
|
||||||
<form autocomplete="off" {onsubmit}>
|
<form autocomplete="off" {onsubmit}>
|
||||||
<div class="ms-4 mt-4 flex flex-col">
|
<div class="ms-4 mt-4 flex flex-col">
|
||||||
|
<SettingAccordion key="albums" title={$t('albums')} subtitle={$t('albums_feature_description')}>
|
||||||
|
<div class="ms-4 mt-6">
|
||||||
|
<SettingSelect
|
||||||
|
label={$t('albums_default_sort_order')}
|
||||||
|
desc={$t('albums_default_sort_order_description')}
|
||||||
|
options={[
|
||||||
|
{ value: AssetOrder.Asc, text: $t('oldest_first') },
|
||||||
|
{ value: AssetOrder.Desc, text: $t('newest_first') },
|
||||||
|
]}
|
||||||
|
bind:value={defaultAssetOrder}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</SettingAccordion>
|
||||||
|
|
||||||
<SettingAccordion key="folders" title={$t('folders')} subtitle={$t('folders_feature_description')}>
|
<SettingAccordion key="folders" title={$t('folders')} subtitle={$t('folders_feature_description')}>
|
||||||
<div class="ms-4 mt-6">
|
<div class="ms-4 mt-6">
|
||||||
<SettingSwitch title={$t('enable')} bind:checked={foldersEnabled} />
|
<SettingSwitch title={$t('enable')} bind:checked={foldersEnabled} />
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import type { UserPreferencesResponseDto } from '@immich/sdk';
|
import { AssetOrder, type UserPreferencesResponseDto } from '@immich/sdk';
|
||||||
import { Sync } from 'factory.ts';
|
import { Sync } from 'factory.ts';
|
||||||
|
|
||||||
export const preferencesFactory = Sync.makeFactory<UserPreferencesResponseDto>({
|
export const preferencesFactory = Sync.makeFactory<UserPreferencesResponseDto>({
|
||||||
|
albums: {
|
||||||
|
defaultAssetOrder: AssetOrder.Desc,
|
||||||
|
},
|
||||||
cast: {
|
cast: {
|
||||||
gCastEnabled: false,
|
gCastEnabled: false,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user