mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
@@ -6,7 +6,7 @@ defmodule Web.Clients.Show do
|
||||
def mount(%{"id" => id}, _session, socket) do
|
||||
with {:ok, client} <-
|
||||
Clients.fetch_client_by_id(id, socket.assigns.subject,
|
||||
preload: [:actor, last_used_token: [identity: [:provider]]]
|
||||
preload: [:online?, :actor, last_used_token: [identity: [:provider]]]
|
||||
) do
|
||||
if connected?(socket) do
|
||||
:ok = Clients.subscribe_to_clients_presence_for_actor(client.actor)
|
||||
|
||||
@@ -97,6 +97,28 @@ defmodule Web.Live.Clients.ShowTest do
|
||||
assert table["user agent"] =~ client.last_seen_user_agent
|
||||
end
|
||||
|
||||
test "shows client online status", %{
|
||||
account: account,
|
||||
client: client,
|
||||
identity: identity,
|
||||
conn: conn
|
||||
} do
|
||||
:ok = Domain.Clients.connect_client(client)
|
||||
|
||||
{:ok, lv, _html} =
|
||||
conn
|
||||
|> authorize_conn(identity)
|
||||
|> live(~p"/#{account}/clients/#{client}")
|
||||
|
||||
table =
|
||||
lv
|
||||
|> element("#client")
|
||||
|> render()
|
||||
|> vertical_table_to_map()
|
||||
|
||||
assert table["status"] =~ "Online"
|
||||
end
|
||||
|
||||
test "updates client online status using presence", %{
|
||||
account: account,
|
||||
client: client,
|
||||
|
||||
Reference in New Issue
Block a user