mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Show groups posts
This commit is contained in:
		
							
								
								
									
										29
									
								
								lib/lists/groups_list.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								lib/lists/groups_list.dart
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
import 'dart:collection';
 | 
			
		||||
 | 
			
		||||
import 'package:comunic/models/group.dart';
 | 
			
		||||
 | 
			
		||||
/// Groups list
 | 
			
		||||
///
 | 
			
		||||
/// @author Pierre HUBERT
 | 
			
		||||
 | 
			
		||||
class GroupsList extends MapBase<int, Group> {
 | 
			
		||||
 | 
			
		||||
  final Map<int, Group> _groups = Map();
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Group operator [](Object key) => _groups[key];
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  void operator []=(int key, Group value) => _groups[key] = value;
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  void clear() => _groups.clear();
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Iterable<int> get keys => _groups.keys;
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Group remove(Object key) => _groups.remove(key);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -9,7 +9,6 @@ import 'package:comunic/models/post.dart';
 | 
			
		||||
/// @author Pierre HUBERT
 | 
			
		||||
 | 
			
		||||
class PostsList extends ListBase<Post> {
 | 
			
		||||
 | 
			
		||||
  List<Post> _list = List();
 | 
			
		||||
 | 
			
		||||
  int get length => _list.length;
 | 
			
		||||
@@ -29,14 +28,22 @@ class PostsList extends ListBase<Post> {
 | 
			
		||||
    forEach((p) {
 | 
			
		||||
      set.add(p.userID);
 | 
			
		||||
 | 
			
		||||
      if(p.userPageID != null && p.userPageID > 0)
 | 
			
		||||
        set.add(p.userPageID);
 | 
			
		||||
      if (p.userPageID != null && p.userPageID > 0) set.add(p.userPageID);
 | 
			
		||||
 | 
			
		||||
      if(p.comments != null)
 | 
			
		||||
        set.addAll(p.comments.usersID);
 | 
			
		||||
      if (p.comments != null) set.addAll(p.comments.usersID);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    return set;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
  /// Get the list of groups in this list of posts
 | 
			
		||||
  Set<int> get groupsID {
 | 
			
		||||
    Set<int> set = Set();
 | 
			
		||||
 | 
			
		||||
    forEach((p) {
 | 
			
		||||
      if (p.isGroupPost) set.add(p.groupID);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    return set;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user