-
Notifications
You must be signed in to change notification settings - Fork 55
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
DXCDT-302: Fix prompts update failing for non-login prompt types #584
Conversation
@@ -214,9 +214,12 @@ func downloadDefaultBrandingTextTranslations(prompt, language string) map[string | |||
return nil | |||
} | |||
|
|||
selectedPrompt := allPrompts[0][prompt].(map[string]interface{}) |
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.
The issue is that the allPrompts
is a set of twenty-something values, each with a single-property object pertaining to a specific prompt type.
This is why the login
prompt was working, because it was the zeroth index in this set.
selectedPrompt := allPrompts[0][prompt].(map[string]interface{}) | ||
|
||
return selectedPrompt | ||
for _, value := range allPrompts { |
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.
Now, we'll want to iterated through all the values to match the provided prompt type.
🔧 Changes
As reported by #515, #575, the command
auth0 branding texts update <PROMPT_TYPE>
will always fail when the prompt type is notlogin
. For example,auth0 branding texts update signup
would always fail.This failure is caused by faulty logic that doesn't adequate traverse a set of default values for the provide prompt type, but this is better illustrated in the diff below. Further, if the prompt type is not found in the set of default values, which could happen if the default values change or new prompt types are added, the editor will start with an empty object instead of panicking.
📚 References
Related Issues: #515, #575
🔬 Testing
Added two integration tests with fixtures to show that multiple prompt types work now.
📝 Checklist