Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
153 stars 7 forks source link

Pings: Add secure action for sending a ping #477

Open Meorawr opened 9 months ago

Meorawr commented 9 months ago

Currently a /ping slash command exists for triggering a contextual ping at whatever the user is holding their mouse cursor over, or on a specifically named unit.

There's a use case for a secure action to be added which does something similar. While addons can use the "macro" action type to route through to /ping, doing so unfortunately subjects the ping to automatic target detection - if one doesn't specify a target unit, the ping manager will end up pinging any unit under the cursor with no way to prevent this.

This could just be as simple as the following - an action that directly calls C_PingSecure.SendPing with the type and unit fully controllable via attributes on the button would allow us to sidestep any target detection imposed via the macro approach, and composes well with the "pending ping" request in #478.

local SecureSendPing = C_PingSecure.SendPing;

SECURE_ACTIONS.ping =
    function (self, unit, button)
        local pingType = SecureButton_GetModifiedAttribute(self, "ping-type", button);
        SecureSendPing(pingType, UnitGUID(unit));
    end;