Skip to content

Commit 74c846d

Browse files
committed
fix: Notes title on new accounts
Fresh Vector accounts with no previous 'sent-to-self' notes will fail to display the Notes title, instead showing their name, this has been resolved.
1 parent 6fa2eae commit 74c846d

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/main.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -1217,10 +1217,10 @@ let strCurrentReplyReference = "";
12171217
* @param {boolean} fClicked - Whether the chat was opened manually or not
12181218
*/
12191219
async function updateChat(profile, arrMessages = [], fClicked = false) {
1220-
if (profile?.messages.length || arrMessages.length) {
1221-
// If this chat is our own npub: then we consider this our Bookmarks/Notes section
1222-
const fNotes = strOpenChat === strPubkey;
1220+
// If this chat is our own npub: then we consider this our Bookmarks/Notes section
1221+
const fNotes = strOpenChat === strPubkey;
12231222

1223+
if (profile?.messages.length || arrMessages.length) {
12241224
// Prefer displaying their name, otherwise, npub
12251225
if (fNotes) {
12261226
domChatContact.textContent = 'Notes';
@@ -1405,12 +1405,16 @@ async function updateChat(profile, arrMessages = [], fClicked = false) {
14051405
}
14061406
} else {
14071407
// Probably a 'New Chat', as such, we'll mostly render an empty chat
1408-
domChatContact.textContent = profile?.name || strOpenChat.substring(0, 10) + '…';
1408+
if (fNotes) {
1409+
domChatContact.textContent = 'Notes';
1410+
} else {
1411+
domChatContact.textContent = profile?.name || strOpenChat.substring(0, 10) + '…';
1412+
}
14091413

14101414
// Force wipe the 'Status' and it's styling
1411-
domChatContactStatus.textContent = '';
1412-
domChatContact.classList.add('chat-contact');
1413-
domChatContact.classList.remove('chat-contact-with-status');
1415+
domChatContactStatus.textContent = fNotes ? domChatContactStatus.textContent = 'Encrypted Notes to Self' : '';
1416+
domChatContact.classList.add('chat-contact-with-status');
1417+
domChatContact.classList.remove('chat-contact');
14141418
}
14151419

14161420
adjustSize();

0 commit comments

Comments
 (0)