fix(@desktop): post user model refactor issues

This commit is contained in:
Patryk Osmaczko 2022-06-12 18:17:18 +02:00 committed by osmaczko
parent 4bfebcdea2
commit 524c91dbab
5 changed files with 25 additions and 25 deletions

@ -1 +1 @@
Subproject commit 5361b56e9fb42c33d56257f1a2aa19946d1daf36
Subproject commit b816643e2d71e20509e8d15e28cebc93e24d02cc

View File

@ -32,13 +32,13 @@ ScrollView {
visible: {
if (selectMode) {
return !searchString || model.name.toLowerCase().includes(searchString)
return !searchString || model.displayName.toLowerCase().includes(searchString)
}
return checkbox.checked
}
title: !model.name.endsWith(".eth") && !!model.localNickname ?
model.localNickname : Utils.removeStatusEns(model.name)
title: !model.displayName.endsWith(".eth") && !!model.localNickname ?
model.localNickname : Utils.removeStatusEns(model.displayName)
image.source: Global.getProfileImage(model.pubKey)
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey)

View File

@ -39,8 +39,8 @@ RowLayout {
visible: false
model: root.chatContentModule.usersModule.model
delegate: Item {
property string publicId: model.id
property string name: model.name
property string pubKey: model.pubKey
property string name: model.displayName
property string icon: model.icon
property bool isAdmin: model.isAdmin
}
@ -51,8 +51,8 @@ RowLayout {
visible: false
model: root.rootStore.contactsModel
delegate: Item {
property string publicId: model.pubKey
property string name: model.name
property string pubKey: model.pubKey
property string name: model.displayName
property string icon: model.icon
}
}
@ -69,7 +69,7 @@ RowLayout {
// Add all group users different than me
if(!entry.isAdmin) {
d.groupUsersModel.insert(d.groupUsersModel.count,
{"publicId": entry.publicId,
{"pubKey": entry.pubKey,
"name": entry.name,
"icon": entry.icon})
}
@ -79,7 +79,7 @@ RowLayout {
for (var j = 0; j < contactsModelListView.count; j ++) {
var entry2 = contactsModelListView.itemAtIndex(j)
d.contactsModel.insert(d.contactsModel.count,
{"publicId": entry2.publicId,
{"pubKey": entry2.pubKey,
"name": entry2.name,
"icon": entry2.icon,
"isIdenticon": false,
@ -97,7 +97,7 @@ RowLayout {
var exists = false
for (var i = 0; i < groupUsersModelListView.count; i ++) {
var entry = groupUsersModelListView.itemAtIndex(i)
if(entry.publicId === memberId) {
if(entry.pubKey === memberId) {
exists = true
break
}

View File

@ -209,14 +209,14 @@ StatusModal {
delegate: StatusListItem {
id: contactRow
title: model.name
title: model.displayName
statusListItemTitle.font.pixelSize: 17
statusListItemTitleAside.font.pixelSize: 17
label: model.isAdmin ? qsTrId("group-chat-admin"): ""
image.source: model.icon
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.id)
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey)
icon: StatusIconSettings {
color: Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(model.id)]
color: Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(model.pubKey)]
charactersLen: 2
isLetterIdenticon: model.icon === ""
height: isLetterIdenticon ? 40 : 20
@ -242,7 +242,7 @@ StatusModal {
icon.height: 16
//% "Make Admin"
text: qsTrId("make-admin")
onTriggered: popup.chatSectionModule.makeAdmin("", popup.chatDetails.id, model.id)
onTriggered: popup.chatSectionModule.makeAdmin("", popup.chatDetails.id, model.pubKey)
}
StatusMenuItem {
icon.name: "remove-contact"
@ -251,13 +251,13 @@ StatusModal {
type: StatusMenuItem.Type.Danger
//% "Remove From Group"
text: qsTrId("remove-from-group")
onTriggered: popup.chatSectionModule.removeMemberFromGroupChat("", popup.chatDetails.id, model.id)
onTriggered: popup.chatSectionModule.removeMemberFromGroupChat("", popup.chatDetails.id, model.pubKey)
}
}
}
]
onTitleClicked: {
Global.openProfilePopup(model.id, popup)
Global.openProfilePopup(model.pubKey, popup)
}
}
}

View File

@ -22,7 +22,7 @@ Page {
property var emojiPopup: null
Keys.onEscapePressed: {
root.rootStore.openCreateChat = false;
root.rootStore.openCreateChat = false;
}
ListView {
@ -31,8 +31,8 @@ Page {
anchors.right: parent.right
model: root.rootStore.contactsModel
delegate: Item {
property string publicId: model.pubKey
property string name: model.name
property string pubKey: model.pubKey
property string displayName: model.displayName
property string icon: model.icon
}
}
@ -44,7 +44,7 @@ Page {
for (var i = 0; i < contactsModelListView.count; i ++) {
var entry = contactsModelListView.itemAtIndex(i);
contactsModel.insert(contactsModel.count,
{"publicId": entry.publicId, "name": entry.name,
{"pubKey": entry.pubKey, "displayName": entry.displayName,
"icon": entry.icon});
}
tagSelector.sortModel(root.contactsModel);
@ -58,15 +58,15 @@ Page {
function createChat() {
if (tagSelector.namesModel.count === 1) {
var ensName = tagSelector.namesModel.get(0).name.includes(".eth") ? tagSelector.namesModel.get(0).name : "";
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", tagSelector.namesModel.get(0).publicId, ensName);
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", tagSelector.namesModel.get(0).pubKey, ensName);
} else {
var groupName = "";
var publicIds = [];
var pubKeys = [];
for (var i = 0; i < tagSelector.namesModel.count; i++) {
groupName += (tagSelector.namesModel.get(i).name + (i === tagSelector.namesModel.count - 1 ? "" : "&"));
publicIds.push(tagSelector.namesModel.get(i).publicId);
pubKeys.push(tagSelector.namesModel.get(i).pubKey);
}
root.rootStore.chatCommunitySectionModule.createGroupChat("",groupName, JSON.stringify(publicIds));
root.rootStore.chatCommunitySectionModule.createGroupChat("",groupName, JSON.stringify(pubKeys));
}
chatInput.textInput.clear();