Repository navigation
Store the labels of new issues and pull requests - #1464
Merged
Merged
Conversation
The issue and pull request webhooks pass the label ids of a new item as an array to IssueModel::add(). The table bound the array unchanged, and insertObject() skips array values, so new items were stored without labels until a later save. add() now converts the ids to the comma separated list the table stores, using the same helper as save(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of Changes
When an issue or pull request is opened on GitHub, the issues and pulls webhooks (
ReceiveIssuesHook,ReceivePullsHook, andReceiveCommentsHookwhen a comment arrives first) pass the label ids fromprocessLabels()as an array toIssueModel::add().add()handed the array toIssuesTable::save()unchanged; the table bound it to thelabelsfield, andDatabaseDriver::insertObject()skips array values. So new items were stored without labels until a later save (an edit in the tracker, alabeledevent for issues, or a CLI sync). Pull requests are hit hardest, because label events for pull requests are not processed.IssueModel::save()already converted the ids to the comma separated list the column stores. That conversion is now a private helper,implodeLabelIds(), used by bothadd()andsave(). Behaviour ofsave()is unchanged (an empty list still storesnull). Values that are not arrays are stored as before, including the''thatprocessLabels()returns when GitHub can't be reached.Found while checking the PHPStan level 5 report (
processLabels()returns a string in its error branches); that part is harmless and is left as is, becausesave()keeps the stored labels for a non-array value.Testing Instructions
IssueModelAddTest: label ids are stored as12,7,3; an empty list asnull; a string ('12,7','') unchanged. The list and empty-list cases fail without the fix.pull_request"opened" webhook of such a PR). Without the fix the new item shows no labels; with the fix it shows them.phpunit, PHPStan (as configured in CI) and php-cs-fixer pass.Documentation Changes Required
None.
🤖 Generated with Claude Code