Invite banner (callbacks not implemented yet)
This commit is contained in:
parent
c95308106b
commit
ee4e6470a9
5
TODO.md
5
TODO.md
@ -1,5 +1,7 @@
|
||||
- invite/leave/forget backend funcs
|
||||
- license headers
|
||||
- replace "property var" by "property <object>" where applicable
|
||||
- replace "property var" by "property <object>" where applicable and
|
||||
var by string and readonly
|
||||
- [debug mode](https://docs.python.org/3/library/asyncio-dev.html)
|
||||
- `pyotherside.atexit()`
|
||||
|
||||
@ -69,7 +71,6 @@ OLD
|
||||
- When inviting someone to direct chat, room is "Empty room" until accepted,
|
||||
it should be the peer's display name instead.
|
||||
- See `Qt.callLater()` potential usages
|
||||
- Banner name color instead of bold
|
||||
- Animate RoomEventDelegate DayBreak apparition
|
||||
- Room subtitle: show things like "*Image*" instead of blank, etc
|
||||
|
||||
|
@ -18,7 +18,7 @@ class RoomUpdated(Event):
|
||||
avatar_url: str = ""
|
||||
topic: str = ""
|
||||
|
||||
inviter: str = ""
|
||||
inviter_id: str = ""
|
||||
left_event: Dict[str, str] = field(default_factory=dict)
|
||||
|
||||
|
||||
|
@ -207,7 +207,7 @@ class MatrixClient(nio.AsyncClient):
|
||||
display_name = self._get_room_name(room) or "",
|
||||
avatar_url = room.gen_avatar_url or "",
|
||||
topic = room.topic or "",
|
||||
inviter = room.inviter or "",
|
||||
inviter_id = room.inviter or "",
|
||||
)
|
||||
|
||||
for room_id, info in resp.rooms.join.items():
|
||||
|
@ -1,19 +1,23 @@
|
||||
import QtQuick 2.7
|
||||
import "../../Base"
|
||||
import "../../utils.js" as Utils
|
||||
|
||||
Banner {
|
||||
property var inviter: null
|
||||
property string inviterId: ""
|
||||
|
||||
readonly property var inviterInfo:
|
||||
inviterId ? users.getUser(inviterId) : null
|
||||
|
||||
color: HStyle.chat.inviteBanner.background
|
||||
|
||||
// TODO: get disp name from users, inviter = userid now
|
||||
avatar.name: inviter ? inviter.displayname : ""
|
||||
//avatar.imageUrl: inviter ? inviter.avatar_url : ""
|
||||
avatar.name: inviterId ? inviterInfo.displayName : ""
|
||||
avatar.imageUrl: inviterId ? inviterInfo.avatarUrl : ""
|
||||
|
||||
labelText:
|
||||
(inviter ?
|
||||
("<b>" + inviter.displayname + "</b>") : qsTr("Someone")) +
|
||||
" " + qsTr("invited you to join the room.")
|
||||
labelText: qsTr("%1 invited you to join the room.").arg(
|
||||
inviterId ?
|
||||
Utils.coloredNameHtml(inviterInfo.displayName, inviterId) :
|
||||
qsTr("Someone")
|
||||
)
|
||||
|
||||
buttonModel: [
|
||||
{
|
||||
@ -31,12 +35,18 @@ Banner {
|
||||
buttonCallbacks: {
|
||||
"accept": function(button) {
|
||||
button.loading = true
|
||||
Backend.clients.get(chatPage.userId).joinRoom(chatPage.roomId)
|
||||
py.callClientCoro(
|
||||
chatPage.userId, "join", [chatPage.roomId], {},
|
||||
function() { button.loading = false }
|
||||
)
|
||||
},
|
||||
|
||||
"decline": function(button) {
|
||||
button.loading = true
|
||||
Backend.clients.get(chatPage.userId).leaveRoom(chatPage.roomId)
|
||||
py.callClientCoro(
|
||||
chatPage.userId, "room_leave", [chatPage.roomId], {},
|
||||
function() { button.loading = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,10 +57,10 @@ HColumnLayout {
|
||||
|
||||
//TypingMembersBar {}
|
||||
|
||||
// InviteBanner {
|
||||
//visible: category === "Invites"
|
||||
//inviter: roomInfo.inviter
|
||||
//}
|
||||
InviteBanner {
|
||||
visible: category === "Invites"
|
||||
inviterId: roomInfo.inviterId
|
||||
}
|
||||
|
||||
//UnknownDevicesBanner {
|
||||
//visible: category == "Rooms" && hasUnknownDevices
|
||||
|
@ -1,5 +1,5 @@
|
||||
function onRoomUpdated(user_id, category, room_id, display_name, avatar_url,
|
||||
topic, inviter, left_event) {
|
||||
topic, inviter_id, left_event) {
|
||||
|
||||
roomCategories.upsert({"userId": user_id, "name": category}, {
|
||||
"userId": user_id,
|
||||
@ -26,7 +26,7 @@ function onRoomUpdated(user_id, category, room_id, display_name, avatar_url,
|
||||
display_name = old_room.displayName
|
||||
avatar_url = old_room.avatarUrl
|
||||
topic = old_room.topic
|
||||
inviter = old_room.topic
|
||||
inviter_id = old_room.inviterId
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ function onRoomUpdated(user_id, category, room_id, display_name, avatar_url,
|
||||
"displayName": display_name,
|
||||
"avatarUrl": avatar_url,
|
||||
"topic": topic,
|
||||
"inviter": inviter,
|
||||
"inviterId": inviter_id,
|
||||
"leftEvent": left_event
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user