Skip to content

Store the labels of new issues and pull requests - #1464

Merged
Hackwar merged 1 commit into
joomla:masterfrom
Hackwar:fix/store-labels-of-new-issues
Nov 11, 2026
Merged

Hackwar merged 1 commit into
joomla:masterfrom
Hackwar:fix/store-labels-of-new-issues

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 11, 2026

Copy link
Copy Markdown
Member

Summary of Changes

When an issue or pull request is opened on GitHub, the issues and pulls webhooks (ReceiveIssuesHook, ReceivePullsHook, and ReceiveCommentsHook when a comment arrives first) pass the label ids from processLabels() as an array to IssueModel::add(). add() handed the array to IssuesTable::save() unchanged; the table bound it to the labels field, and DatabaseDriver::insertObject() skips array values. So new items were stored without labels until a later save (an edit in the tracker, a labeled event 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 both add() and save(). Behaviour of save() is unchanged (an empty list still stores null). Values that are not arrays are stored as before, including the '' that processLabels() 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, because save() keeps the stored labels for a non-array value.

Testing Instructions

  • New IssueModelAddTest: label ids are stored as 12,7,3; an empty list as null; a string ('12,7', '') unchanged. The list and empty-list cases fail without the fix.
  • Manually: open a pull request with labels on a project connected to a test tracker (or redeliver the 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

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>
@Hackwar
Hackwar merged commit a685190 into joomla:master Nov 11, 2026
9 checks passed
@Hackwar
Hackwar deleted the fix/store-labels-of-new-issues branch November 11, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant