fix(login): defer downgrade popup, guard data, include CoA classes
lint / lint (push) Has been cancelled

Three fixes addressing the reported 'auras silently vanish on next save'
bug, plus collateral robustness in the same code path:

1. WeakAuras.lua PLAYER_LOGIN handler (~L1297-1308): the downgrade branch
   fired StaticPopup_Show('WEAKAURAS_CONFIRM_REPAIR', ...) synchronously
   inside the event handler. On the CoA reworked StaticPopup system this
   fires too early and silently fails to show the dialog, which means
   neither OnAccept nor OnCancel ever runs, so Private.Login() is never
   called. With no displays loaded, the next PLAYER_LOGOUT serializes an
   empty table over WeakAurasSaved and the user loses all their auras.
   Wrap the call in C_Timer.After(0, ...) so it fires after the event
   frame stack has unwound and the popup system is ready.

   This is the most likely root cause of the user report 'my auras don't
   save anymore' that surfaced on the PTR last week.

2. WeakAuras.lua WEAKAURAS_CONFIRM_REPAIR popup (~L2263-2277): OnShow and
   OnCancel both unconditionally dereferenced self.data.reason. If the
   popup is ever fired with nil or malformed data this throws and blocks
   Private.Login() from running via the OnCancel fallback. Guard with a
   nil check and default reason to 'unknown' (treated as the automatic /
   downgrade path, which is the safe default that still invokes Login).

3. Types.lua WeakAuras.class_types (~L1187): only populated from
   CLASS_SORT_ORDER, which on CoA contains only the 11 vanilla classes.
   The 21 custom CoA classes were silently missing from every class
   filter dropdown in the options UI. Add a fallback loop over
   LOCALIZED_CLASS_NAMES_MALE for anything CLASS_SORT_ORDER didn't
   already register, mirroring the pattern the spec builder uses at
   ~L3829.
This commit is contained in:
2026-05-24 17:38:22 +02:00
parent 43b5f05a4c
commit 6078989cb1
2 changed files with 33 additions and 4 deletions
+10
View File
@@ -1187,6 +1187,16 @@ WeakAuras.class_types = {}
for i, class in ipairs(CLASS_SORT_ORDER) do
WeakAuras.class_types[class] = WrapTextInColorCode(LOCALIZED_CLASS_NAMES_MALE[class], WA_GetClassColor(class))
end
-- CoA: CLASS_SORT_ORDER only contains the 11 vanilla classes, missing the 21
-- custom CoA classes. Fall back to LOCALIZED_CLASS_NAMES_MALE for anything not
-- yet registered. Same pattern used by the spec builder further down this file.
if LOCALIZED_CLASS_NAMES_MALE then
for class in pairs(LOCALIZED_CLASS_NAMES_MALE) do
if not WeakAuras.class_types[class] then
WeakAuras.class_types[class] = WrapTextInColorCode(LOCALIZED_CLASS_NAMES_MALE[class], WA_GetClassColor(class))
end
end
end
if WeakAuras.IsClassicPlus() then
WeakAuras.class_types["DEATHKNIGHT"] = nil
end