Stop sending branch as a Zetkin person field#9
Merged
Conversation
BranchAssignment was injecting 'branch' into customFieldsConfig and customFields. The core join-block plugin forwards customFields as direct fields to Zetkin's People API, which rejects 'branch' as an invalid parameter — causing the entire Zetkin signup to fail and leaving members with no branch assigned. Branch assignment in Zetkin is handled correctly by the ck_join_flow_add_tags filter; the customFields/customFieldsConfig injection was redundant and harmful. Removed it, and updated tests accordingly.
The ck_join_flow_pre_handle_join filter no longer writes customFields['branch'], so the second branch in the fallback chain could never resolve. Drop it and delete the test that covered the removed path.
These log statements reported on a key that is no longer populated by this plugin, so they always emitted "NOT SET" and added noise without information.
The two negative tests assert the absence of a specific field shape — without context, future readers have no way to know they guard against a real production incident. Add a block comment explaining the bug, why the injection was harmful, and what the tests pin.
The hook-lifecycle table showed that tagging happens but not how or why. Add a dedicated section covering the flow into Mailchimp / Action Network / Zetkin, the Zetkin-specific constraint that branch must travel as a tag rather than a custom person field, and the no-branch fallback case.
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
BranchAssignment.phpwas injectingbranchintocustomFieldsConfigandcustomFieldson every joincustomFieldsas direct person fields to Zetkin's People APIbranchas an invalid parameter — the entire signup call fails, leaving members with no branch assigned in Zetkinck_join_flow_add_tagsfilter was already correctly adding the branch as a Zetkin tag; it just never fired because person creation failed firstcustomFieldsConfig/customFieldsinjection;$data['branch']is still set so the tag filter continues to workTest plan
./vendor/bin/phpunit— all 231 tests passtest_does_not_add_branch_to_custom_fields_configandtest_does_not_set_branch_in_custom_fieldsare present and green