Unify getUser

Always use `NeoChatRoom::getUser` for getting user details in a room context.
- `MessageEventModel` now calls `getUser`
- `getUser` is now overloaded to also be able to take a `NeoChatUser*`
- add params to `getUser` that are needed for the model outputs
This commit is contained in:
James Graham
2023-05-27 18:27:28 +00:00
parent f2aa375b43
commit e1d4b66479
8 changed files with 120 additions and 61 deletions

View File

@@ -15,7 +15,6 @@ QQC2.Control {
property alias textField: textField
property bool isReplying: currentRoom.chatBoxReplyId.length > 0
property NeoChatUser replyUser: currentRoom.chatBoxReplyUser
property bool attachmentPaneVisible: currentRoom.chatBoxAttachmentPath.length > 0
signal messageSent()
@@ -244,9 +243,9 @@ QQC2.Control {
Component {
id: replyPane
ReplyPane {
userName: root.replyUser ? root.replyUser.displayName : ""
userColor: root.replyUser ? root.replyUser.color : ""
userAvatar: root.replyUser ? "image://mxc/" + currentRoom.getUser(root.replyUser.id).avatarMediaId : ""
userName: currentRoom.chatBoxReplyUser.displayName
userColor: currentRoom.chatBoxReplyUser.color
userAvatar: currentRoom.chatBoxReplyUser.avatarSource
text: currentRoom.chatBoxReplyMessage
}
}

View File

@@ -54,7 +54,7 @@ Components.AlbumMaximizeComponent {
implicitWidth: Kirigami.Units.iconSizes.medium
implicitHeight: Kirigami.Units.iconSizes.medium
name: root.author.name ?? root.author.displayName
name: root.author.displayName
source: root.author.avatarSource
color: root.author.color
}
@@ -62,7 +62,7 @@ Components.AlbumMaximizeComponent {
spacing: 0
QQC2.Label {
id: userLabel
text: root.author.name ?? root.author.displayName
text: root.author.displayName
color: root.author.color
font.weight: Font.Bold
elide: Text.ElideRight

View File

@@ -93,7 +93,7 @@ TimelineContainer {
visible: root.asset === "m.self"
width: height
height: parent.height / 3 + 1
name: root.author.name ?? root.author.displayName
name: root.author.displayName
source: root.author.avatarSource
color: root.author.color
}

View File

@@ -100,7 +100,7 @@ Item {
implicitHeight: Kirigami.Units.iconSizes.small
source: root.author.avatarSource
name: root.author.displayName || ""
name: root.author.displayName
color: root.author.color
}
QQC2.Label {

View File

@@ -381,7 +381,7 @@ ColumnLayout {
visible: root.showAuthor &&
Config.showAvatarInTimeline &&
(Config.compactLayout || !showUserMessageOnRight)
name: root.author.name ?? root.author.displayName
name: root.author.displayName
source: root.author.avatarSource
color: root.author.color