diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index dd17c02f..a3b9082e 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -561,6 +561,13 @@ var ComunicWeb = { */ interface: { //TODO : implement + }, + + /** + * Friends utilities + */ + utils: { + //TODO : implement } }, diff --git a/assets/js/components/friends/utils.js b/assets/js/components/friends/utils.js new file mode 100644 index 00000000..c44ca9cd --- /dev/null +++ b/assets/js/components/friends/utils.js @@ -0,0 +1,29 @@ +/** + * Friends component utilities + * + * @author Pierre HUBERT + */ + +ComunicWeb.components.friends.utils = { + + /** + * Extract the IDs of the friends of the users from a friends list + * + * @param {array} list The friends list to process + * @return {array} The list of IDs + */ + getUsersIdFromPersonnalList: function(list){ + + //Parse the list + usersID = []; + list.forEach(friend => { + //Extract user id + usersID.push(friend.ID_friend); + }); + + //Return the generated list + return usersID; + }, + + +} \ No newline at end of file diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 5db28dc1..f66426da 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -216,6 +216,7 @@ class Dev { "js/components/friends/friendsBar.js", "js/components/friends/listModal.js", "js/components/friends/interface.js", + "js/components/friends/utils.js", //Private conversations "js/components/conversations/manager.js",