Have inviter display name and avatar for rooms
This commit is contained in:
parent
2ac484b8f5
commit
3270c6dd19
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user