(fix/Transmission): prevent missing controlledChildren when importing newer groups without their original parent

(cherry picked from commit a8df20ae1f374069d792990fe096e0b788fc0c1c)
This commit is contained in:
NoM0Re
2026-02-14 18:27:24 +01:00
committed by andrew6180
parent a9140e9b9e
commit d494eab111
3 changed files with 45 additions and 30 deletions
+3 -2
View File
@@ -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
@@ -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);
+41 -27
View File
@@ -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<uid, UidMapData>
--- @field type "new"|"old"
--- @field root uid uid of the root
--- @field totalCount number
--- @field idToUid table<auraId, uid> 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<uid, UidMapData>
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);