From d494eab111dccfb567a9f07770a7ac8ac9e80d5b Mon Sep 17 00:00:00 2001 From: NoM0Re <1629787+NoM0Re@users.noreply.github.com> Date: Sat, 14 Feb 2026 18:27:24 +0100 Subject: [PATCH] (fix/Transmission): prevent missing controlledChildren when importing newer groups without their original parent (cherry picked from commit a8df20ae1f374069d792990fe096e0b788fc0c1c) --- WeakAuras/Transmission.lua | 5 +- .../OptionsFrames/ImportExport.lua | 2 +- WeakAurasOptions/OptionsFrames/Update.lua | 68 +++++++++++-------- 3 files changed, 45 insertions(+), 30 deletions(-) diff --git a/WeakAuras/Transmission.lua b/WeakAuras/Transmission.lua index bc5d7cf..ee5aca0 100644 --- a/WeakAuras/Transmission.lua +++ b/WeakAuras/Transmission.lua @@ -541,7 +541,8 @@ function WeakAuras.Import(inData, target, callbackFunc, linkedAuras) return nil, "Invalid import data." end - local highestVersion = data.internalVersion or 0 + -- Let people install auras that are newer than their version of WeakAuras, even tho it is bad + --[[local highestVersion = data.internalVersion or 0 if children then for _, child in ipairs(children) do highestVersion = max(highestVersion, child.internalVersion or 0) @@ -551,7 +552,7 @@ function WeakAuras.Import(inData, target, callbackFunc, linkedAuras) -- Do not run PreAdd but still show Import Window tooltipLoading = nil; return ImportNow(data, children, target, linkedAuras, nil, callbackFunc) - end + end]] if version < 2000 then if children then diff --git a/WeakAurasOptions/OptionsFrames/ImportExport.lua b/WeakAurasOptions/OptionsFrames/ImportExport.lua index 40a6c24..5390af1 100644 --- a/WeakAurasOptions/OptionsFrames/ImportExport.lua +++ b/WeakAurasOptions/OptionsFrames/ImportExport.lua @@ -62,7 +62,7 @@ local function ConstructImportExport(frame) elseif(mode == "table") then displayStr = OptionsPrivate.Private.DataToString(id, true); end - input.editBox:SetMaxBytes(nil); -- Dragonflight doesn't accept nil + --input.editBox:SetMaxBytes(nil); Dragonflight doesn't accept nil input.editBox:SetScript("OnEscapePressed", function() group:Close(); end); diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 5ae82ce..6db10e9 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -290,26 +290,39 @@ end local function BuildUidMap(data, children, type) children = children or {} -- The eventual result + + --- @class UidMapData + --- @field originalName auraId The original id of the aura + --- @field id auraId The current id of the aura, might have changed due to ids being unique + --- @field data auraData The raw data, is non-authoritative on e.g. id, controlledChildren, parent, sortHybridTable + --- @field controlledChildren? uid[] A array of child uids + --- @field parent? uid The parent uid + --- @field sortHybrid boolean? optional bool !! the parent's sortHybridTable is split up and recorded per aura: + --- nil, if the parent is not a dynamic group + --- false/true based on the sortHybridTable of the dynamic group + --- @field anchorFrameFrame uid? uid of the anchor iff the aura is anchored to another aura that is part of the same + --- import, otherwise nil + --- @field matchedUid uid? for "update", the matched uid. Is from a different domain! + --- @field diff any for "update", the diff and the categories of that diff between the aura and its match + --- @field categories? table the categories + --- @field index? number helpers that transport data between phase 1 and 2 + --- @field total? number helpers that transport data between phase 1 and 2 + --- @field parentIsDynamicGroup? boolean helpers that transport data between phase 1 and 2 + + --- @class UidMap + --- @field map table + --- @field type "new"|"old" + --- @field root uid uid of the root + --- @field totalCount number + --- @field idToUid table maps from id to uid local uidMap = { - map = { -- per uid - -- originalName: The original id of the aura - -- id: The current id of the aura, might have changed due to ids being unique - -- data: The raw data, contains non-authoritative information on e.g. id, controlledChildren, parent, sortHybridTable - -- controlledChildren: A array of child uids - -- parent: The parent uid - -- sortHybrid: optional bool !! the parent's sortHybridTable is split up and recorded per aura: - -- nil, if the parent is not a dynamic group - -- false/true based on the sortHybridTable of the dynamic group - - -- matchedUid: for "update", the matched uid. Is from a different domain! - -- diff, categories: for "update", the diff and the categories of that diff between the aura and its match - - -- index, total, parentIsDynamicGroup: helpers that transport data between phase 1 and 2 + --- @type table + map = { }, type = type, -- Either old or new, only used for error checking - root = data.uid, -- root: uid of the root - totalCount = #children + 1, -- totalCount: count of members - idToUid = {} -- idToUid maps from id to uid + root = data.uid, + totalCount = #children + 1, + idToUid = {} } -- Build helper map from id to uid @@ -348,17 +361,16 @@ local function BuildUidMap(data, children, type) -- Handle anchorFrameFrame if data.anchorFrameType == "SELECTFRAME" - and data.anchorFrameFrame - and data.anchorFrameFrame:sub(1, 10) == "WeakAuras:" - then - local target = data.anchorFrameFrame:sub(11) - if idToUid[target] then - uidMap.map[data.uid].anchorFrameFrame = idToUid[target] + and data.anchorFrameFrame + and data.anchorFrameFrame:sub(1, 10) == "WeakAuras:" + then + local target = data.anchorFrameFrame:sub(11) + if idToUid[target] then + uidMap.map[data.uid].anchorFrameFrame = idToUid[target] + end end end - end - local function handleSortHybridTable(data) if data.regionType == "dynamicgroup" then local sortHybridTableByUid = {} @@ -1380,7 +1392,7 @@ local methods = { self:ReleaseChildren() self:AddBasicInformationWidgets(data, sender) - --[[ + --[[ Let people install auras that are newer than their version of WeakAuras, even tho it is bad do local highestVersion = data.internalVersion or 0 if children then @@ -1546,7 +1558,7 @@ local methods = { self:AddChild(linkedAurasText) end - -- Let people install auras that are newer than their version of WeakAuras + -- Let people install auras that are newer than their version of WeakAuras, even tho it is bad local highestVersion = data.internalVersion or 0 if children then for _, child in ipairs(children) do @@ -1670,6 +1682,7 @@ local methods = { self:AddBasicInformationWidgets(pendingData.data, pendingData.sender) self:AddProgressWidgets() + ---@type {uid: uid, data: auraData, source: string}[] local copies = {} local pendingPickData @@ -2234,6 +2247,7 @@ local methods = { local updateFrame local function ConstructUpdateFrame(frame) + ---@class GroupUpdateFrame: AceGUIFrame local group = AceGUI:Create("ScrollFrame"); group.frame:SetParent(frame); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -63);