diff --git a/src/python/matrix_client.py b/src/python/matrix_client.py index 58935ee8..9535e2b7 100644 --- a/src/python/matrix_client.py +++ b/src/python/matrix_client.py @@ -333,12 +333,17 @@ class MatrixClient(nio.AsyncClient): except KeyError: last_ev = None + inviter = getattr(room, "inviter", "") or "" + + self.models[Room, self.user_id][room.room_id] = Room( room_id = room.room_id, display_name = name, avatar_url = room.gen_avatar_url or "", topic = room.topic or "", - inviter_id = getattr(room, "inviter", "") or "", + inviter_id = inviter, + inviter_name = room.user_name(inviter) if inviter else "", + inviter_avatar = room.avatar_url(inviter) if inviter else "", left = left, filter_string = " ".join({name, room.topic or ""}).strip(), last_event = last_ev, diff --git a/src/python/models/items.py b/src/python/models/items.py index 33c55f83..2f1d73b6 100644 --- a/src/python/models/items.py +++ b/src/python/models/items.py @@ -30,6 +30,8 @@ class Room(ModelItem): avatar_url: str = "" topic: str = "" inviter_id: str = "" + inviter_name: str = "" + inviter_avatar: str = "" left: bool = False filter_string: str = "" typing_members: List[str] = field(default_factory=list) diff --git a/src/qml/Chat/Banners/InviteBanner.qml b/src/qml/Chat/Banners/InviteBanner.qml index c269d1ab..23cbfa75 100644 --- a/src/qml/Chat/Banners/InviteBanner.qml +++ b/src/qml/Chat/Banners/InviteBanner.qml @@ -3,25 +3,24 @@ import "../../Base" import "../../utils.js" as Utils Banner { - property string inviterId: "" - - readonly property var inviterInfo: - inviterId ? users.find(inviterId) : null + property string inviterId: chatPage.roomInfo.inviter + property string inviterName: chatPage.roomInfo.inviter_name + property string inviterAvatar: chatPage.roomInfo.inviter_avatar color: theme.chat.inviteBanner.background avatar.userId: inviterId + avatar.displayName: inviterName + avatar.avatarUrl: inviterAvatar - labelText: qsTr("%1 invited you to join the room.").arg( - inviterId && inviterInfo ? - Utils.coloredNameHtml(inviterInfo.displayName, inviterId) : - qsTr("Someone") + labelText: qsTr("%1 invited you to the room.").arg( + Utils.coloredNameHtml(inviterName, inviterId) ) buttonModel: [ { name: "accept", - text: qsTr("Accept"), + text: qsTr("Join"), iconName: "invite-accept", }, {