mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
When upserting a client, the device name would overwrite any name changes performed by the admin. To prevent this, we don't allow changing a device's name on upsert conflicts, only on initial insert and updates. Fixes #8536 Co-authored-by: Antoine <antoinelabarussias@gmail.com>
This commit is contained in:
@@ -19,7 +19,6 @@ defmodule Domain.Clients.Client.Changeset do
|
||||
Clients.Client.Query.all()
|
||||
|> update([clients: clients],
|
||||
set: [
|
||||
name: fragment("EXCLUDED.name"),
|
||||
public_key: fragment("EXCLUDED.public_key"),
|
||||
last_used_token_id: fragment("EXCLUDED.last_used_token_id"),
|
||||
last_seen_user_agent: fragment("EXCLUDED.last_seen_user_agent"),
|
||||
|
||||
@@ -497,7 +497,7 @@ defmodule Domain.ClientsTest do
|
||||
|
||||
assert Repo.aggregate(Clients.Client, :count, :id) == 1
|
||||
|
||||
assert updated_client.name != client.name
|
||||
assert updated_client.name == client.name
|
||||
assert updated_client.last_seen_remote_ip.address == subject.context.remote_ip
|
||||
assert updated_client.last_seen_remote_ip != client.last_seen_remote_ip
|
||||
assert updated_client.last_seen_user_agent == subject.context.user_agent
|
||||
|
||||
Reference in New Issue
Block a user