Retrieve last seen time for offline room members
This commit is contained in:
@@ -6,10 +6,13 @@ import "../../../.."
|
||||
import "../../../../Base"
|
||||
import "../../../../Base/HTile"
|
||||
import "../../../../Popups"
|
||||
import "../../../../PythonBridge"
|
||||
|
||||
HTile {
|
||||
id: member
|
||||
|
||||
property Future getPresenceFuture: null
|
||||
|
||||
backgroundColor: theme.chat.roomPane.listView.member.background
|
||||
contentOpacity:
|
||||
model.invited ? theme.chat.roomPane.listView.member.invitedOpacity : 1
|
||||
@@ -145,6 +148,14 @@ HTile {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
if (model.presence === "offline" && model.last_active_at < new Date(1))
|
||||
getPresenceFuture = py.callClientCoro(
|
||||
chat.userId, "get_offline_presence", [model.id],
|
||||
)
|
||||
|
||||
Component.onDestruction: if (getPresenceFuture) getPresenceFuture.cancel()
|
||||
|
||||
Behavior on contentOpacity { HNumberAnimation {} }
|
||||
Behavior on spacing { HNumberAnimation {} }
|
||||
|
||||
|
@@ -20,6 +20,7 @@ HListView {
|
||||
property bool powerLevelFieldFocused: false
|
||||
|
||||
property Future setPowerFuture: null
|
||||
property Future getPresenceFuture: null
|
||||
|
||||
function loadDevices() {
|
||||
py.callClientCoro(userId, "member_devices", [member.id], devices => {
|
||||
@@ -269,8 +270,21 @@ HListView {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: loadDevices()
|
||||
Component.onDestruction: if (setPowerFuture) setPowerFuture.cancel()
|
||||
Component.onCompleted: {
|
||||
loadDevices()
|
||||
|
||||
if (member.presence === "offline" &&
|
||||
member.last_active_at < new Date(1))
|
||||
{
|
||||
getPresenceFuture =
|
||||
py.callClientCoro(userId, "get_offline_presence", [member.id])
|
||||
}
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
if (setPowerFuture) setPowerFuture.cancel()
|
||||
if (getPresenceFuture) getPresenceFuture.cancel()
|
||||
}
|
||||
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
Keys.onReturnPressed: if (! root.powerLevelFieldFocused && currentItem) {
|
||||
|
Reference in New Issue
Block a user