src/main/ChatController.js
/**
 * Upon selection of an invitation, chat is joined and its data is loaded.
 * Chat is displayed at main panel and added to list.
 */
Upon selection of an invitation, chat is joined and its data is loaded.
Chat is displayed at main panel and added to list.
Upon selection of an invitation chat is joined and its data is loaded . Chat is displayed at main panel and added to list .
async function joinChat() {
    var url = this.getAttribute("id").replace("join", "");
    let i = 0;
    while (i < chatsToJoin.length && chatsToJoin[i].url !== url) {
        i++;
    }
    const chat = chatsToJoin[i];
    chatsToJoin.splice(i, 1);
    userDataUrl = await baseService.getDefaultDataUrl(userWebId);
    chat.url = await baseService.generateUniqueUrlForResource(userDataUrl);
    await joinService.joinExistingChat(userDataUrl, chat.interlocutorWebId, userWebId, chat.url, chat.interlocutorName, chat.members);
    var friendPhoto = chat.photo;
    if (!friendPhoto) {
        friendPhoto = await baseService.getPhoto(chat.interlocutorWebId);
        if (!friendPhoto)
            friendPhoto = baseService.getDefaultFriendPhoto();
    }
    chat.photo = friendPhoto;
    semanticChats.push(chat);
    var index = semanticChats.indexOf(chat);
    if (chat.members)
        contactsWithChat.splice(index, 0, chat.interlocutorName);
    else
        contactsWithChat.splice(index, 0, chat.interlocutorWebId);
    await showChats();
    await loadMessages(index);
    await showAndStoreMessages();
}
async function joinChat ( ) { var url = this . getAttribute ( "id" ) . replace ( "join" , "" ) ; let i = 0 ; while ( i < chatsToJoin . length && chatsToJoin [ i ] . url !== url ) { i ++ ; } const chat = chatsToJoin [ i ] ; chatsToJoin . splice ( i , 1 ) ; userDataUrl = await baseService . getDefaultDataUrl ( userWebId ) ; chat . url = await baseService . generateUniqueUrlForResource ( userDataUrl ) ; await joinService . joinExistingChat ( userDataUrl , chat . interlocutorWebId , userWebId , chat . url , chat . interlocutorName , chat . members ) ; var friendPhoto = chat . photo ; if ( ! friendPhoto ) { friendPhoto = await baseService . getPhoto ( chat . interlocutorWebId ) ; if ( ! friendPhoto ) friendPhoto = baseService . getDefaultFriendPhoto ( ) ; } chat . photo = friendPhoto ; semanticChats . push ( chat ) ; var index = semanticChats . indexOf ( chat ) ; if ( chat . members ) contactsWithChat . splice ( index , 0 , chat . interlocutorName ) ; else contactsWithChat . splice ( index , 0 , chat . interlocutorWebId ) ; await showChats ( ) ; await loadMessages ( index ) ; await showAndStoreMessages ( ) ; }
Upon selection of an invitation, chat is joined and its data is loaded.
Upon selection of an invitation chat is joined and its data is loaded .