Repository navigation
Add startup welcome messages and feedback links #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| -- Shared welcome formatting, session state and copy UI live in private libchev. | ||
| local Addon = _G.PvPTogether | ||
| local LibChev = Addon.LibChev | ||
|
|
||
| -- Register only our own link type through Blizzard's public dispatcher. The | ||
| -- handler consumes the primitive link string, never foreign context tables. | ||
| function Addon:RegisterWelcomeLink(linkType, callback) | ||
| if not self:CanAccessTable(LinkUtil) then | ||
| return false | ||
| end | ||
| local exists, register = LinkUtil.IsLinkHandlerRegistered, LinkUtil.RegisterLinkHandler | ||
| if | ||
| not self:CanAccessValue(exists) | ||
| or not self:CanAccessValue(register) | ||
| or type(exists) ~= "function" | ||
| or type(register) ~= "function" | ||
| then | ||
| return false | ||
| end | ||
| local ok, registered = pcall(exists, linkType) | ||
| if not ok or not self:CanAccessValue(registered) or registered ~= false then | ||
| return false | ||
| end | ||
| return pcall(register, linkType, callback) | ||
| end | ||
|
|
||
| function Addon:GetWelcomeUIPolicy() | ||
| return { | ||
| parent = UIParent, | ||
| createFrame = CreateFrame, | ||
| restricted = function() | ||
| return not self.IsNameplateAugmentationBlockedInCurrentContext | ||
| or self:IsNameplateAugmentationBlockedInCurrentContext() | ||
| end, | ||
| canMutate = LibChev.CanMutateOwnedRegion, | ||
| } | ||
| end | ||
|
|
||
| function Addon:GetWelcomeController() | ||
| local controller = rawget(self, "welcomeController") | ||
| if not controller then | ||
| controller = LibChev.NewWelcomeController({ | ||
| addonName = "PvPTogether", | ||
| linkType = "pvptogetherfeedback", | ||
| curseforgeURL = "https://www.curseforge.com/wow/addons/pvptogether", | ||
| githubURL = "https://github.com/AlexAllocated/PvPTogether", | ||
| command = "/pt", | ||
| clients = "Retail, WoW Forever, Classic Era, Hardcore, Season of Discovery, TBC Anniversary, Mists Classic, and Titan Reforged", | ||
| getVersion = function() | ||
| return self:GetDiagnosticVersion() | ||
| end, | ||
| registerLink = function(linkType, callback) | ||
| return self:RegisterWelcomeLink(linkType, callback) | ||
| end, | ||
| print = function(text) | ||
| self:Print(text) | ||
| end, | ||
| ui = self:GetWelcomeUIPolicy(), | ||
| }) | ||
| self.welcomeController = controller | ||
| end | ||
| return controller | ||
| end | ||
|
|
||
| function Addon:PrintWelcomeMessage() | ||
| -- A partially updated installation must never prevent normal addon startup. | ||
| if type(LibChev.NewWelcomeController) ~= "function" then | ||
| return false | ||
| end | ||
| local ok, controller = pcall(self.GetWelcomeController, self) | ||
| if not ok then | ||
| return false | ||
| end | ||
| local announced, result = pcall(controller.Announce, controller) | ||
| return announced and result == true | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
C_RestrictedActions.CheckAllowProtectedFunctions(region, true)denies a mutation while the coarse restriction predicates are inactive, this policy still authorizes every feedback-window setter becauseCanMutateOwnedRegionchecks only accessibility andIsProtected. Unlike the existing debug UI policy inCore.lua, the feedback UI never delegates toCanMutateNameplateFrame, so clicking a feedback link can attempt denied mutations; the surroundingpcallcan provide the chat fallback but cannot make those attempts taint-safe. Compose the owned-region check with the addon's native permission check before allowing mutations.AGENTS.md reference: AGENTS.md:L9-L10
Useful? React with 👍 / 👎.