diff --git a/index.html b/index.html index 9d51c11..37c6770 100644 --- a/index.html +++ b/index.html @@ -1596,15 +1596,15 @@ }) } - function getContactName(floID) { - if (floDapps.user.get_contact(floID)) - return floDapps.user.get_contact(floID) - else if (messenger.groups[floID]) - return messenger.groups[floID].name - else if (floID === floDapps.user.id) + function getContactName(contactAddress) { + if (floDapps.user.get_contact(contactAddress)) + return floDapps.user.get_contact(contactAddress) + else if (messenger.groups[contactAddress]) + return messenger.groups[contactAddress].name + else if (floCrypto.isSameAddr(contactAddress, floDapps.user.id)) return 'You' else - return floID + return contactAddress } window.addEventListener('hashchange', e => routeTo(window.location.hash)) window.addEventListener("load", () => { @@ -2525,13 +2525,13 @@ ` }, - contactCard(floID, options = {}) { + contactCard(contactAddress, options = {}) { let { type, prepend = false, markUnread = false, ref } = options - let name = getContactName(floID) + let name = getContactName(contactAddress) let initial if (type === 'group') { initial = html` ` - name = messenger.groups[floID].name + name = messenger.groups[contactAddress].name } else if (type === 'pipeline') { initial = html`` } else { @@ -2539,9 +2539,9 @@ } if (type !== 'contact') { //render chat card for newly added contact - getLastMessage(floID).then(lastMessage => { + getLastMessage(contactAddress).then(lastMessage => { const { lastText, time } = lastMessage - const chatCard = getChatCard(floID) + const chatCard = getChatCard(contactAddress) if (chatCard && !chatCard.querySelector('.last-message')) { const timeAndOptions = html` @@ -2556,23 +2556,23 @@ } }).catch(error => console.error(error)) if (prepend) { - activeChat.address = floID + activeChat.address = contactAddress getRef('chats_list').querySelectorAll('.active').forEach(child => child.classList.remove('active')) } } let tag = 'BTC' - if (type === 'pipeline' && messenger.pipeline[floID].model === 'flo_multisig') { + if (type === 'pipeline' && messenger.pipeline[contactAddress].model === 'flo_multisig') { tag = 'FLO' } const className = `contact ${type !== 'contact' ? type : ''} ${markUnread ? 'unread' : ''} interactive` - return html.for(ref, floID)` -
+ return html.for(ref, contactAddress)` +
${initial}
- ${type === 'pipeline' ? html`
${tag} Multisig ${messenger.pipeline[floID].disabled ? ' - Completed' : ''}
` : ''} + ${type === 'pipeline' ? html`
${tag} Multisig ${messenger.pipeline[contactAddress].disabled ? ' - Completed' : ''}
` : ''}

${name}

- ${type === 'contact' ? html`

${floID}

` : ''} + ${type === 'contact' ? html`

${contactAddress}

` : ''}
` },