diff --git a/src/qml/Base/HUserAvatar.qml b/src/qml/Base/HUserAvatar.qml index abfcc211..92308045 100644 --- a/src/qml/Base/HUserAvatar.qml +++ b/src/qml/Base/HUserAvatar.qml @@ -3,7 +3,7 @@ import QtQuick 2.7 HAvatar { property string userId: "" - readonly property var userInfo: userId ? users.getUser(userId) : ({}) + readonly property var userInfo: userId ? users.find(userId) : ({}) name: userInfo.displayName || userId.substring(1) // no leading @ imageUrl: userInfo.avatarUrl diff --git a/src/qml/Chat/Banners/InviteBanner.qml b/src/qml/Chat/Banners/InviteBanner.qml index 68ad9533..e38b13dc 100644 --- a/src/qml/Chat/Banners/InviteBanner.qml +++ b/src/qml/Chat/Banners/InviteBanner.qml @@ -6,7 +6,7 @@ Banner { property string inviterId: "" readonly property var inviterInfo: - inviterId ? users.getUser(inviterId) : null + inviterId ? users.find(inviterId) : null color: theme.chat.inviteBanner.background diff --git a/src/qml/Chat/Banners/LeftBanner.qml b/src/qml/Chat/Banners/LeftBanner.qml index ec45ae68..6aa2858a 100644 --- a/src/qml/Chat/Banners/LeftBanner.qml +++ b/src/qml/Chat/Banners/LeftBanner.qml @@ -3,13 +3,13 @@ import "../../Base" Banner { property string userId: "" - readonly property var userInfo: users.getUser(userId) + readonly property var userInfo: users.find(userId) color: theme.chat.leftBanner.background // TODO: avatar func auto avatar.userId: userId - avatar.imageUrl: users.getUser(userId).avatarUrl + avatar.imageUrl: users.find(userId).avatarUrl labelText: qsTr("You are not part of this room anymore.") buttonModel: [ diff --git a/src/qml/Chat/Chat.qml b/src/qml/Chat/Chat.qml index 98cae3d6..02abb78c 100644 --- a/src/qml/Chat/Chat.qml +++ b/src/qml/Chat/Chat.qml @@ -13,7 +13,7 @@ HColumnLayout { readonly property string category: roomInfo.category readonly property string roomId: roomInfo.roomId - readonly property var senderInfo: users.getUser(userId) + readonly property var senderInfo: users.find(userId) readonly property bool hasUnknownDevices: false //category == "Rooms" ? diff --git a/src/qml/Chat/RoomSidePane/MemberDelegate.qml b/src/qml/Chat/RoomSidePane/MemberDelegate.qml index 15bb88b5..ab15ff31 100644 --- a/src/qml/Chat/RoomSidePane/MemberDelegate.qml +++ b/src/qml/Chat/RoomSidePane/MemberDelegate.qml @@ -7,7 +7,7 @@ MouseArea { width: memberList.width height: childrenRect.height - property var memberInfo: users.getUser(model.userId) + property var memberInfo: users.find(model.userId) HRowLayout { width: parent.width diff --git a/src/qml/Chat/RoomSidePane/MembersView.qml b/src/qml/Chat/RoomSidePane/MembersView.qml index f52d4a8d..9740cb93 100644 --- a/src/qml/Chat/RoomSidePane/MembersView.qml +++ b/src/qml/Chat/RoomSidePane/MembersView.qml @@ -24,7 +24,7 @@ HColumnLayout { proxyRoles: ExpressionRole { name: "displayName" - expression: users.getUser(userId).displayName || userId + expression: users.find(userId).displayName || userId } sorters: StringSorter { diff --git a/src/qml/Chat/Timeline/EventDelegate.qml b/src/qml/Chat/Timeline/EventDelegate.qml index b2ce9f2e..dad2b484 100644 --- a/src/qml/Chat/Timeline/EventDelegate.qml +++ b/src/qml/Chat/Timeline/EventDelegate.qml @@ -22,7 +22,7 @@ Column { onReloadPreviousItem: previousItem = getPreviousItem() property var senderInfo: null - Component.onCompleted: senderInfo = users.getUser(model.senderId) + Component.onCompleted: senderInfo = users.find(model.senderId) readonly property bool isOwn: chatPage.userId === model.senderId diff --git a/src/qml/EventHandlers/rooms.js b/src/qml/EventHandlers/rooms.js index c5f51e02..fc3bb3fd 100644 --- a/src/qml/EventHandlers/rooms.js +++ b/src/qml/EventHandlers/rooms.js @@ -7,7 +7,7 @@ function typingTextFor(members, our_user_id) { for (var i = 0; i < members.length; i++) { if (members[i] != our_user_id) { - profiles.push(users.getUser(members[i])) + profiles.push(users.find(members[i])) } } @@ -106,7 +106,7 @@ function onTimelineEventReceived( "isLocalEcho": is_local_echo, "showNameLine": show_name_line, "translatable": translatable, - "targetUserId": target_user_id, + "tarfindId": target_user_id, } if (is_local_echo) { diff --git a/src/qml/Models/Users.qml b/src/qml/Models/Users.qml index a392f59c..3bb8cc8a 100644 --- a/src/qml/Models/Users.qml +++ b/src/qml/Models/Users.qml @@ -3,7 +3,7 @@ import SortFilterProxyModel 0.2 import "../Base" HListModel { - function getUser(user_id) { + function find(user_id) { // Happens when SortFilterProxyModel ExpressionFilter/Sorter/Role tests // the expression with invalid data to establish property bindings if (! user_id) { return } diff --git a/src/qml/SidePane/AccountDelegate.qml b/src/qml/SidePane/AccountDelegate.qml index 4638dc1b..b11c1b6d 100644 --- a/src/qml/SidePane/AccountDelegate.qml +++ b/src/qml/SidePane/AccountDelegate.qml @@ -6,7 +6,7 @@ Column { id: accountDelegate width: parent.width - property var userInfo: users.getUser(model.userId) + property var userInfo: users.find(model.userId) property bool expanded: true diff --git a/src/qml/SidePane/RoomDelegate.qml b/src/qml/SidePane/RoomDelegate.qml index 82e711e0..ee57b173 100644 --- a/src/qml/SidePane/RoomDelegate.qml +++ b/src/qml/SidePane/RoomDelegate.qml @@ -45,7 +45,7 @@ MouseArea { } return Utils.coloredNameHtml( - users.getUser(ev.senderId).displayName, + users.find(ev.senderId).displayName, ev.senderId ) + ": " + py.callSync("inlinify", [ev.content]) } diff --git a/src/qml/utils.js b/src/qml/utils.js index e3dca47e..18eb3e1c 100644 --- a/src/qml/utils.js +++ b/src/qml/utils.js @@ -70,13 +70,13 @@ function translatedEventContent(ev) { if (ev.translatable == false) { return ev.content } // %S → sender display name - var name = users.getUser(ev.senderId).displayName + var name = users.find(ev.senderId).displayName var text = ev.content.replace("%S", coloredNameHtml(name, ev.senderId)) // %T → target (event state_key) display name - if (ev.targetUserId) { - var tname = users.getUser(ev.targetUserId).displayName - text = text.replace("%T", coloredNameHtml(tname, ev.targetUserId)) + if (ev.tarfindId) { + var tname = users.find(ev.tarfindId).displayName + text = text.replace("%T", coloredNameHtml(tname, ev.tarfindId)) } text = qsTr(text)