From e905e4968c13bf39937af1f60a1e21fe5c31ec39 Mon Sep 17 00:00:00 2001 From: Pierre Date: Fri, 19 Jan 2018 06:58:11 +0100 Subject: [PATCH] Get the IDs of personns who sent comments. --- assets/js/components/comments/utils.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/assets/js/components/comments/utils.js b/assets/js/components/comments/utils.js index 4d7098e5..318e67b9 100644 --- a/assets/js/components/comments/utils.js +++ b/assets/js/components/comments/utils.js @@ -6,6 +6,27 @@ ComunicWeb.components.comments.utils = { - + /** + * Get the IDs of the users who posted comments + * + * @param {Object} infos Informations about the comments + * @return {Object} List of users ID + */ + get_users_id: function(infos){ + + //Process the list of users + var users = []; + + var i; + for(i in infos){ + + //If the user isn't already present in the list, add it + if(!users.includes(infos[i].userID)) + users.push(infos[i].userID); + + } + + return users; + } } \ No newline at end of file