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:
|
except KeyError:
|
||||||
last_ev = None
|
last_ev = None
|
||||||
|
|
||||||
|
inviter = getattr(room, "inviter", "") or ""
|
||||||
|
|
||||||
|
|
||||||
self.models[Room, self.user_id][room.room_id] = Room(
|
self.models[Room, self.user_id][room.room_id] = Room(
|
||||||
room_id = room.room_id,
|
room_id = room.room_id,
|
||||||
display_name = name,
|
display_name = name,
|
||||||
avatar_url = room.gen_avatar_url or "",
|
avatar_url = room.gen_avatar_url or "",
|
||||||
topic = room.topic 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,
|
left = left,
|
||||||
filter_string = " ".join({name, room.topic or ""}).strip(),
|
filter_string = " ".join({name, room.topic or ""}).strip(),
|
||||||
last_event = last_ev,
|
last_event = last_ev,
|
||||||
|
|
|
@ -30,6 +30,8 @@ class Room(ModelItem):
|
||||||
avatar_url: str = ""
|
avatar_url: str = ""
|
||||||
topic: str = ""
|
topic: str = ""
|
||||||
inviter_id: str = ""
|
inviter_id: str = ""
|
||||||
|
inviter_name: str = ""
|
||||||
|
inviter_avatar: str = ""
|
||||||
left: bool = False
|
left: bool = False
|
||||||
filter_string: str = ""
|
filter_string: str = ""
|
||||||
typing_members: List[str] = field(default_factory=list)
|
typing_members: List[str] = field(default_factory=list)
|
||||||
|
|
|
@ -3,25 +3,24 @@ import "../../Base"
|
||||||
import "../../utils.js" as Utils
|
import "../../utils.js" as Utils
|
||||||
|
|
||||||
Banner {
|
Banner {
|
||||||
property string inviterId: ""
|
property string inviterId: chatPage.roomInfo.inviter
|
||||||
|
property string inviterName: chatPage.roomInfo.inviter_name
|
||||||
readonly property var inviterInfo:
|
property string inviterAvatar: chatPage.roomInfo.inviter_avatar
|
||||||
inviterId ? users.find(inviterId) : null
|
|
||||||
|
|
||||||
color: theme.chat.inviteBanner.background
|
color: theme.chat.inviteBanner.background
|
||||||
|
|
||||||
avatar.userId: inviterId
|
avatar.userId: inviterId
|
||||||
|
avatar.displayName: inviterName
|
||||||
|
avatar.avatarUrl: inviterAvatar
|
||||||
|
|
||||||
labelText: qsTr("%1 invited you to join the room.").arg(
|
labelText: qsTr("%1 invited you to the room.").arg(
|
||||||
inviterId && inviterInfo ?
|
Utils.coloredNameHtml(inviterName, inviterId)
|
||||||
Utils.coloredNameHtml(inviterInfo.displayName, inviterId) :
|
|
||||||
qsTr("Someone")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
buttonModel: [
|
buttonModel: [
|
||||||
{
|
{
|
||||||
name: "accept",
|
name: "accept",
|
||||||
text: qsTr("Accept"),
|
text: qsTr("Join"),
|
||||||
iconName: "invite-accept",
|
iconName: "invite-accept",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user