You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +02:00
feat(web): display number of likes in asset viewer (#18911)
* feat: display number of likes * fix: properly decrement like count on unlike Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> * chore: pr feedback * chore: updated related test * chore: formatter run * chore: force numberOfLikes to null in album context to pass lint * chore: open-api updated * fix: use undefined, not null * styling tweaks * chore: updated sql --------- Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@ -14,25 +14,31 @@ class ActivityStatisticsResponseDto {
|
||||
/// Returns a new [ActivityStatisticsResponseDto] instance.
|
||||
ActivityStatisticsResponseDto({
|
||||
required this.comments,
|
||||
required this.likes,
|
||||
});
|
||||
|
||||
int comments;
|
||||
|
||||
int likes;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ActivityStatisticsResponseDto &&
|
||||
other.comments == comments;
|
||||
other.comments == comments &&
|
||||
other.likes == likes;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(comments.hashCode);
|
||||
(comments.hashCode) +
|
||||
(likes.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ActivityStatisticsResponseDto[comments=$comments]';
|
||||
String toString() => 'ActivityStatisticsResponseDto[comments=$comments, likes=$likes]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'comments'] = this.comments;
|
||||
json[r'likes'] = this.likes;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -46,6 +52,7 @@ class ActivityStatisticsResponseDto {
|
||||
|
||||
return ActivityStatisticsResponseDto(
|
||||
comments: mapValueOfType<int>(json, r'comments')!,
|
||||
likes: mapValueOfType<int>(json, r'likes')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@ -94,6 +101,7 @@ class ActivityStatisticsResponseDto {
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'comments',
|
||||
'likes',
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user