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