Rename users.getUser to users.find
This commit is contained in:
parent
f64a2c68e9
commit
2170b16175
|
@ -3,7 +3,7 @@ import QtQuick 2.7
|
||||||
HAvatar {
|
HAvatar {
|
||||||
property string userId: ""
|
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 @
|
name: userInfo.displayName || userId.substring(1) // no leading @
|
||||||
imageUrl: userInfo.avatarUrl
|
imageUrl: userInfo.avatarUrl
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ Banner {
|
||||||
property string inviterId: ""
|
property string inviterId: ""
|
||||||
|
|
||||||
readonly property var inviterInfo:
|
readonly property var inviterInfo:
|
||||||
inviterId ? users.getUser(inviterId) : null
|
inviterId ? users.find(inviterId) : null
|
||||||
|
|
||||||
color: theme.chat.inviteBanner.background
|
color: theme.chat.inviteBanner.background
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@ import "../../Base"
|
||||||
|
|
||||||
Banner {
|
Banner {
|
||||||
property string userId: ""
|
property string userId: ""
|
||||||
readonly property var userInfo: users.getUser(userId)
|
readonly property var userInfo: users.find(userId)
|
||||||
|
|
||||||
color: theme.chat.leftBanner.background
|
color: theme.chat.leftBanner.background
|
||||||
|
|
||||||
// TODO: avatar func auto
|
// TODO: avatar func auto
|
||||||
avatar.userId: userId
|
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.")
|
labelText: qsTr("You are not part of this room anymore.")
|
||||||
|
|
||||||
buttonModel: [
|
buttonModel: [
|
||||||
|
|
|
@ -13,7 +13,7 @@ HColumnLayout {
|
||||||
readonly property string category: roomInfo.category
|
readonly property string category: roomInfo.category
|
||||||
readonly property string roomId: roomInfo.roomId
|
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
|
readonly property bool hasUnknownDevices: false
|
||||||
//category == "Rooms" ?
|
//category == "Rooms" ?
|
||||||
|
|
|
@ -7,7 +7,7 @@ MouseArea {
|
||||||
width: memberList.width
|
width: memberList.width
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
|
||||||
property var memberInfo: users.getUser(model.userId)
|
property var memberInfo: users.find(model.userId)
|
||||||
|
|
||||||
HRowLayout {
|
HRowLayout {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
|
@ -24,7 +24,7 @@ HColumnLayout {
|
||||||
|
|
||||||
proxyRoles: ExpressionRole {
|
proxyRoles: ExpressionRole {
|
||||||
name: "displayName"
|
name: "displayName"
|
||||||
expression: users.getUser(userId).displayName || userId
|
expression: users.find(userId).displayName || userId
|
||||||
}
|
}
|
||||||
|
|
||||||
sorters: StringSorter {
|
sorters: StringSorter {
|
||||||
|
|
|
@ -22,7 +22,7 @@ Column {
|
||||||
onReloadPreviousItem: previousItem = getPreviousItem()
|
onReloadPreviousItem: previousItem = getPreviousItem()
|
||||||
|
|
||||||
property var senderInfo: null
|
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
|
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++) {
|
for (var i = 0; i < members.length; i++) {
|
||||||
if (members[i] != our_user_id) {
|
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,
|
"isLocalEcho": is_local_echo,
|
||||||
"showNameLine": show_name_line,
|
"showNameLine": show_name_line,
|
||||||
"translatable": translatable,
|
"translatable": translatable,
|
||||||
"targetUserId": target_user_id,
|
"tarfindId": target_user_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_local_echo) {
|
if (is_local_echo) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import SortFilterProxyModel 0.2
|
||||||
import "../Base"
|
import "../Base"
|
||||||
|
|
||||||
HListModel {
|
HListModel {
|
||||||
function getUser(user_id) {
|
function find(user_id) {
|
||||||
// Happens when SortFilterProxyModel ExpressionFilter/Sorter/Role tests
|
// Happens when SortFilterProxyModel ExpressionFilter/Sorter/Role tests
|
||||||
// the expression with invalid data to establish property bindings
|
// the expression with invalid data to establish property bindings
|
||||||
if (! user_id) { return }
|
if (! user_id) { return }
|
||||||
|
|
|
@ -6,7 +6,7 @@ Column {
|
||||||
id: accountDelegate
|
id: accountDelegate
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
property var userInfo: users.getUser(model.userId)
|
property var userInfo: users.find(model.userId)
|
||||||
|
|
||||||
property bool expanded: true
|
property bool expanded: true
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ MouseArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Utils.coloredNameHtml(
|
return Utils.coloredNameHtml(
|
||||||
users.getUser(ev.senderId).displayName,
|
users.find(ev.senderId).displayName,
|
||||||
ev.senderId
|
ev.senderId
|
||||||
) + ": " + py.callSync("inlinify", [ev.content])
|
) + ": " + py.callSync("inlinify", [ev.content])
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,13 +70,13 @@ function translatedEventContent(ev) {
|
||||||
if (ev.translatable == false) { return ev.content }
|
if (ev.translatable == false) { return ev.content }
|
||||||
|
|
||||||
// %S → sender display name
|
// %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))
|
var text = ev.content.replace("%S", coloredNameHtml(name, ev.senderId))
|
||||||
|
|
||||||
// %T → target (event state_key) display name
|
// %T → target (event state_key) display name
|
||||||
if (ev.targetUserId) {
|
if (ev.tarfindId) {
|
||||||
var tname = users.getUser(ev.targetUserId).displayName
|
var tname = users.find(ev.tarfindId).displayName
|
||||||
text = text.replace("%T", coloredNameHtml(tname, ev.targetUserId))
|
text = text.replace("%T", coloredNameHtml(tname, ev.tarfindId))
|
||||||
}
|
}
|
||||||
|
|
||||||
text = qsTr(text)
|
text = qsTr(text)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user