Upgrade user memberships pane

This commit is contained in:
2021-03-05 15:26:45 +01:00
parent f3c3e9420d
commit 136db55703
7 changed files with 45 additions and 34 deletions

View File

@ -177,7 +177,7 @@ const ConversationsInterface = {
}
//Else, perform an API request
var apiURI = "conversations/getInfosOne";
var apiURI = "conversations/get_single";
var params = {
conversationID: conversationID,
};

View File

@ -9,32 +9,28 @@ const ConversationsUtils = {
/**
* Given conversation informations, returns its name
*
* @param {Object} infos Conversation informations
* @param {Conversation} info Conversation information
* @param {Function} afterName What to do once we got conversation name
* @return {Boolean} True for a success
*/
getName: function(infos, afterName){
getName: function(info, afterName){
//Check if the conversation has a name or not
if(infos.name)
afterName(infos.name);
if(info.name && info.name.length > 0)
afterName(info.name);
else {
//Get informations about the first two members
var firstMembers = [];
//Retrieve IDs
for(o in infos.members){
for(o in info.members){
//Limit number to 2
if(firstMembers.length < 2){
if(firstMembers.length < 2){
//Exclude current user ID
if(info.members[o].user_id != userID())
firstMembers.push(info.members[o].user_id);
//Check this is a valid entry
if(infos.members[o]){
//Exclude current user ID
if(infos.members[o] != userID())
firstMembers.push(infos.members[o]);
}
}
}
@ -42,7 +38,7 @@ const ConversationsUtils = {
ComunicWeb.user.userInfos.getNames(firstMembers, function(usersName){
//For conversations with many members (more than 3 - we musn't forget current user)
if(infos.members.length > 3)
if(info.members.length > 3)
usersName += ", ...";
//Peform next action now