Skip to content
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

Merged
merged 10 commits into from
Jan 9, 2023

Conversation

willvedd
Copy link
Contributor

@willvedd willvedd commented Jan 5, 2023

🔧 Changes

As reported by #515, #575, the command auth0 branding texts update <PROMPT_TYPE> will always fail when the prompt type is not login. 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

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@willvedd willvedd requested a review from a team as a code owner January 5, 2023 22:12
@@ -214,9 +214,12 @@ func downloadDefaultBrandingTextTranslations(prompt, language string) map[string
return nil
}

selectedPrompt := allPrompts[0][prompt].(map[string]interface{})
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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.

@willvedd willvedd merged commit faf1e06 into v1 Jan 9, 2023
@willvedd willvedd deleted the DXCDT-302-update-signup-failing branch January 9, 2023 16:05
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.

3 participants