properly restore local edits of charge sockets

fixes #2368

Signed-off-by: Séverin Lemaignan <severin@guakamole.org>
This commit is contained in:
Séverin Lemaignan
2025-11-24 23:28:15 +01:00
committed by map-per
parent eaa56e5127
commit 3b0b4520a1
2 changed files with 12 additions and 2 deletions

View File

@@ -720,7 +720,17 @@ void EditableMapObject::ApplyJournalEntry(JournalEntry const & entry)
MetadataID type;
if (feature::Metadata::TypeFromString(tagModData.key, type))
{
if (type == MetadataID::FMD_CHARGE_SOCKETS)
{
// Charge sockets need special handling: we need to aggregate the new entry
// to existing ones, not just replace the whole string.
ChargeSocketsHelper helper(GetChargeSockets());
helper.AggregateChargeSocketKey(tagModData.key, tagModData.new_value);
m_metadata.Set(type, helper.ToString());
}
else
m_metadata.Set(type, tagModData.new_value);
if (type == MetadataID::FMD_INTERNET)
{
uint32_t const wifiType = ftypes::IsWifiChecker::Instance().GetType();

View File

@@ -30,7 +30,7 @@ public:
ChargeSocketsHelper(ChargeSocketDescriptors const & sockets) : m_chargeSockets(sockets), m_dirty(true) {}
/** Create a ChareSocketsHelper instance from an existing list of sockets
/** Create a ChargeSocketsHelper instance from an existing list of sockets
* stored as "<type>|<nb>|[<power>];..."
*
* For instance: