Rename users.getUser to users.find
This commit is contained in:
parent
f64a2c68e9
commit
2170b16175
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -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" ?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,7 +24,7 @@ HColumnLayout {
|
|||
|
||||
proxyRoles: ExpressionRole {
|
||||
name: "displayName"
|
||||
expression: users.getUser(userId).displayName || userId
|
||||
expression: users.find(userId).displayName || userId
|
||||
}
|
||||
|
||||
sorters: StringSorter {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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])
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user