mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Display the list of comments
This commit is contained in:
26
lib/lists/comments_list.dart
Normal file
26
lib/lists/comments_list.dart
Normal file
@ -0,0 +1,26 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:comunic/models/comment.dart';
|
||||
|
||||
/// Comments list
|
||||
///
|
||||
/// Contains the list of comments for a post
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
class CommentsList extends ListBase<Comment> {
|
||||
List<Comment> _list = List();
|
||||
|
||||
int get length => _list.length;
|
||||
|
||||
set length(int l) => _list.length = l;
|
||||
|
||||
@override
|
||||
Comment operator [](int index) => _list[index];
|
||||
|
||||
@override
|
||||
void operator []=(int index, Comment value) => _list[index] = value;
|
||||
|
||||
/// Get the list of users in this comments, as a set
|
||||
Set<int> get usersID => map((f) => f.userID).toSet();
|
||||
}
|
@ -31,6 +31,9 @@ class PostsList extends ListBase<Post> {
|
||||
|
||||
if(p.userPageID != null && p.userPageID > 0)
|
||||
set.add(p.userPageID);
|
||||
|
||||
if(p.comments != null)
|
||||
set.addAll(p.comments.usersID);
|
||||
});
|
||||
|
||||
return set;
|
||||
|
Reference in New Issue
Block a user