refactor: use getNickname function for nicknames fetches
This commit is contained in:
parent
a22c5942ff
commit
29a9ca4ef5
|
@ -90,15 +90,7 @@ Item {
|
|||
SelectedMessage.set(messageId, fromAuthor);
|
||||
}
|
||||
// Get contact nickname
|
||||
const contactList = profileModel.contacts.list
|
||||
const contactCount = contactList.rowCount()
|
||||
let nickname = ""
|
||||
for (let i = 0; i < contactCount; i++) {
|
||||
if (contactList.rowData(i, 'pubKey') === fromAuthor) {
|
||||
nickname = contactList.rowData(i, 'localNickname')
|
||||
break;
|
||||
}
|
||||
}
|
||||
let nickname = chatView.getUserNickname(fromAuthor)
|
||||
messageContextMenu.isProfile = !!isProfileClick
|
||||
messageContextMenu.isSticker = isSticker
|
||||
messageContextMenu.emojiOnly = emojiOnly
|
||||
|
|
|
@ -47,6 +47,18 @@ SplitView {
|
|||
return contacts
|
||||
}
|
||||
|
||||
function getUserNickname(pubKey) {
|
||||
// Get contact nickname
|
||||
const contactList = profileModel.contacts.list
|
||||
const contactCount = contactList.rowCount()
|
||||
for (let i = 0; i < contactCount; i++) {
|
||||
if (contactList.rowData(i, 'pubKey') === pubKey) {
|
||||
return contactList.rowData(i, 'localNickname')
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: applicationWindow
|
||||
onSettingsLoaded: {
|
||||
|
|
|
@ -80,18 +80,7 @@ ModalPopup {
|
|||
width: parent.width
|
||||
height: identicon.height
|
||||
|
||||
property string nickname: {
|
||||
// Get contact nickname
|
||||
const contactList = profileModel.contacts.list
|
||||
const contactCount = contactList.rowCount()
|
||||
let nickname = ""
|
||||
for (let i = 0; i < contactCount; i++) {
|
||||
if (contactList.rowData(i, 'pubKey') === model.pubKey) {
|
||||
return contactList.rowData(i, 'localNickname')
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
property string nickname: chatView.getUserNickname(model.pubKey)
|
||||
|
||||
StatusImageIdenticon {
|
||||
id: identicon
|
||||
|
|
|
@ -210,18 +210,7 @@ ModalPopup {
|
|||
width: parent.width
|
||||
height: identicon.height
|
||||
|
||||
property string nickname: {
|
||||
// Get contact nickname
|
||||
const contactList = profileModel.contacts.list
|
||||
const contactCount = contactList.rowCount()
|
||||
let nickname = ""
|
||||
for (let i = 0; i < contactCount; i++) {
|
||||
if (contactList.rowData(i, 'pubKey') === model.pubKey) {
|
||||
return contactList.rowData(i, 'localNickname')
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
property string nickname: chatView.getUserNickname(model.pubKey)
|
||||
|
||||
StatusImageIdenticon {
|
||||
id: identicon
|
||||
|
|
|
@ -172,6 +172,7 @@ DISTFILES += \
|
|||
app/AppLayouts/Chat/CommunityComponents/CommunitiesPopup.qml \
|
||||
app/AppLayouts/Chat/CommunityComponents/CommunityButton.qml \
|
||||
app/AppLayouts/Chat/CommunityComponents/CommunityDetailPopup.qml \
|
||||
app/AppLayouts/Chat/CommunityComponents/CommunityMembersPopup.qml \
|
||||
app/AppLayouts/Chat/CommunityComponents/CommunityList.qml \
|
||||
app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml \
|
||||
app/AppLayouts/Chat/CommunityComponents/CreateChannelPopup.qml \
|
||||
|
|
Loading…
Reference in New Issue