mirror of
https://github.com/immich-app/immich.git
synced 2025-12-16 17:23:16 +03:00
fix(server,web): correctly show album level like (#4916)
* fix: like in global activity * refactor: rename isGlobal to ReactionLevel.Album * chore: open api * chore: e2e test for album vs comment duplicate like checking --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
@@ -133,6 +133,7 @@ part 'model/person_response_dto.dart';
|
||||
part 'model/person_statistics_response_dto.dart';
|
||||
part 'model/person_update_dto.dart';
|
||||
part 'model/queue_status_dto.dart';
|
||||
part 'model/reaction_level.dart';
|
||||
part 'model/reaction_type.dart';
|
||||
part 'model/recognition_config.dart';
|
||||
part 'model/scan_library_dto.dart';
|
||||
|
||||
13
mobile/openapi/lib/api/activity_api.dart
generated
13
mobile/openapi/lib/api/activity_api.dart
generated
@@ -112,8 +112,10 @@ class ActivityApi {
|
||||
///
|
||||
/// * [ReactionType] type:
|
||||
///
|
||||
/// * [ReactionLevel] level:
|
||||
///
|
||||
/// * [String] userId:
|
||||
Future<Response> getActivitiesWithHttpInfo(String albumId, { String? assetId, ReactionType? type, String? userId, }) async {
|
||||
Future<Response> getActivitiesWithHttpInfo(String albumId, { String? assetId, ReactionType? type, ReactionLevel? level, String? userId, }) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/activity';
|
||||
|
||||
@@ -131,6 +133,9 @@ class ActivityApi {
|
||||
if (type != null) {
|
||||
queryParams.addAll(_queryParams('', 'type', type));
|
||||
}
|
||||
if (level != null) {
|
||||
queryParams.addAll(_queryParams('', 'level', level));
|
||||
}
|
||||
if (userId != null) {
|
||||
queryParams.addAll(_queryParams('', 'userId', userId));
|
||||
}
|
||||
@@ -157,9 +162,11 @@ class ActivityApi {
|
||||
///
|
||||
/// * [ReactionType] type:
|
||||
///
|
||||
/// * [ReactionLevel] level:
|
||||
///
|
||||
/// * [String] userId:
|
||||
Future<List<ActivityResponseDto>?> getActivities(String albumId, { String? assetId, ReactionType? type, String? userId, }) async {
|
||||
final response = await getActivitiesWithHttpInfo(albumId, assetId: assetId, type: type, userId: userId, );
|
||||
Future<List<ActivityResponseDto>?> getActivities(String albumId, { String? assetId, ReactionType? type, ReactionLevel? level, String? userId, }) async {
|
||||
final response = await getActivitiesWithHttpInfo(albumId, assetId: assetId, type: type, level: level, userId: userId, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
||||
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
@@ -355,6 +355,8 @@ class ApiClient {
|
||||
return PersonUpdateDto.fromJson(value);
|
||||
case 'QueueStatusDto':
|
||||
return QueueStatusDto.fromJson(value);
|
||||
case 'ReactionLevel':
|
||||
return ReactionLevelTypeTransformer().decode(value);
|
||||
case 'ReactionType':
|
||||
return ReactionTypeTypeTransformer().decode(value);
|
||||
case 'RecognitionConfig':
|
||||
|
||||
3
mobile/openapi/lib/api_helper.dart
generated
3
mobile/openapi/lib/api_helper.dart
generated
@@ -100,6 +100,9 @@ String parameterToString(dynamic value) {
|
||||
if (value is PathType) {
|
||||
return PathTypeTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is ReactionLevel) {
|
||||
return ReactionLevelTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is ReactionType) {
|
||||
return ReactionTypeTypeTransformer().encode(value).toString();
|
||||
}
|
||||
|
||||
85
mobile/openapi/lib/model/reaction_level.dart
generated
Normal file
85
mobile/openapi/lib/model/reaction_level.dart
generated
Normal file
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// 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 ReactionLevel {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const ReactionLevel._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const album = ReactionLevel._(r'album');
|
||||
static const asset = ReactionLevel._(r'asset');
|
||||
|
||||
/// List of all possible values in this [enum][ReactionLevel].
|
||||
static const values = <ReactionLevel>[
|
||||
album,
|
||||
asset,
|
||||
];
|
||||
|
||||
static ReactionLevel? fromJson(dynamic value) => ReactionLevelTypeTransformer().decode(value);
|
||||
|
||||
static List<ReactionLevel>? listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <ReactionLevel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = ReactionLevel.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [ReactionLevel] to String,
|
||||
/// and [decode] dynamic data back to [ReactionLevel].
|
||||
class ReactionLevelTypeTransformer {
|
||||
factory ReactionLevelTypeTransformer() => _instance ??= const ReactionLevelTypeTransformer._();
|
||||
|
||||
const ReactionLevelTypeTransformer._();
|
||||
|
||||
String encode(ReactionLevel data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a ReactionLevel.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
ReactionLevel? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'album': return ReactionLevel.album;
|
||||
case r'asset': return ReactionLevel.asset;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [ReactionLevelTypeTransformer] instance.
|
||||
static ReactionLevelTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user