This repository was archived by the owner on May 30, 2024. It is now read-only.
FEATURE: allow User Custom Field input field to accept the UserField name #225
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.
Currently the
add_user_to_group_through_custom_field
script expects the UserCustomField name to be used when the automation is triggered with the "Recurring" trigger, and the UserField name to be used when the automation is triggered by the "User first logged in" trigger. This is confusing for users. For both triggers, it would be better if the UserField name could be used. That's the name that is displayed on the Admin / Customize / User Fields page.This PR attempts to fix the issue in a backwards compatible way, so that existing automations that are making use of the UserCustomField name (for example: 'user_field_5') will not be broken.
The PR also updates the "with one matching user" test to set the UserCustomField name in the way that Discourse sets the name - based on the UserField's id.
Related discussion on Meta: https://meta.discourse.org/t/add-user-to-group-script-has-different-field-input-for-the-two-triggers/281813