diff --git a/assets/js/components/conversations/utils.js b/assets/js/components/conversations/utils.js index 82eb18eb..a931eebb 100644 --- a/assets/js/components/conversations/utils.js +++ b/assets/js/components/conversations/utils.js @@ -54,6 +54,27 @@ ComunicWeb.components.conversations.utils = { return true; }, + /** + * Given a conversation ID, get its name + * + * @param {number} id The ID of the target conversation + * @param {function} onGotName Function called once we have got the name of the conversation + */ + getNameForID: function(id, onGotName){ + + ComunicWeb.components.conversations.interface.getInfosOne(id, function(info){ + + //Check if an error occurred + if(info.error) + return onGotName(false); + + //Get and return the name of the conversation + ComunicWeb.components.conversations.utils.getName(info, onGotName); + + }); + + }, + /** * Create and display a conversation creation / edition form *