Skip to content

Commit

Permalink
core: Fix contextual ping on header children (#661)
Browse files Browse the repository at this point in the history
When header children would spawn during combat (e.g. a raid member
joins) it would throw an error because we can't set attributes then.

Moving the attribute setter into a non-header block plus
`initialConfigFunction` solves this, while we gotta keep the Mixin call
where it was as the Mixin function (nor the arg we pass through it)
exists in a secure environment.
  • Loading branch information
p3lim authored Oct 31, 2023
1 parent 8739982 commit f987d20
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ouf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ local function initObject(unit, style, styleFunc, header, ...)
object:SetAttribute('*type2', 'togglemenu')
object:SetAttribute('toggleForVehicle', true)

--[[ frame.IsPingable
This boolean can be set to false to disable the frame from being pingable. Enabled by default.
--]]
--[[ Override: frame:GetContextualPingType()
Used to define which contextual ping is used for the frame.
By default this wraps `C_Ping.GetContextualPingTypeForUnit(UnitGUID(frame.unit))`.
--]]
object:SetAttribute('ping-receiver', true)

if(isEventlessUnit(objectUnit)) then
oUF:HandleEventlessUnit(object)
else
Expand Down Expand Up @@ -346,15 +356,6 @@ local function initObject(unit, style, styleFunc, header, ...)
func(object)
end

--[[ frame.IsPingable
This boolean can be set to false to disable the frame from being pingable. Enabled by default.
--]]
--[[ Override: frame:GetContextualPingType()
Used to define which contextual ping is used for the frame.
By default this wraps `C_Ping.GetContextualPingTypeForUnit(UnitGUID(frame.unit))`.
--]]
object:SetAttribute('ping-receiver', true)
Mixin(object, PingableType_UnitFrameMixin)

-- Make Clique kinda happy
Expand Down Expand Up @@ -605,6 +606,8 @@ do
frame:SetAttribute('*type1', 'target')
frame:SetAttribute('*type2', 'togglemenu')
frame:SetAttribute('oUF-guessUnit', unit)
frame:SetAttribute('ping-receiver', true)
end
local body = header:GetAttribute('oUF-initialConfigFunction')
Expand Down

0 comments on commit f987d20

Please sign in to comment.