From 8b31b6088c2fe8eeab0d999da6ab012fa4ebd267 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 19 Feb 2018 16:42:57 +0100 Subject: [PATCH] Added comments users ID parsing. --- .../comunic/client/data/posts/PostsList.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/posts/PostsList.java b/app/src/main/java/org/communiquons/android/comunic/client/data/posts/PostsList.java index 1445959..380e4a3 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/posts/PostsList.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/posts/PostsList.java @@ -1,5 +1,7 @@ package org.communiquons.android.comunic.client.data.posts; +import org.communiquons.android.comunic.client.data.comments.Comment; + import java.util.ArrayList; /** @@ -17,7 +19,7 @@ public class PostsList extends ArrayList { private static final String TAG = "PostsList"; /** - * Get the IDs of the users who created the posts + * Get the IDs of the users who created the posts and their comments * * @return The list of users of the post */ @@ -31,6 +33,18 @@ public class PostsList extends ArrayList { //Add User ID if required if(!ids.contains(userID)) ids.add(userID); + + if(post.getComments_list() != null){ + + //Process the list of comments + for(Comment comment : post.getComments_list()){ + + if(ids.contains(comment.getUserID())) + ids.add(comment.getUserID()); + + } + + } } return ids;