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

Incorrect behaviour after Product update with invalid public base URL #3028

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/api/services/settings.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
= semantic_form_for @service, url: admin_service_path(@service) do |form|
= render partial: 'api/services/forms/integration_settings', locals: { form: form, service: @service }
= form.actions do
= form.commit_button 'Update Product', button_html: { name: 'update_settings' }
= form.commit_button 'Update Product', button_html: { name: 'update_settings', value: 'true' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but what does this do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ensures that when the error occurs, it doesn't redirect to the edit template, as you can see here:

render action: params[:update_settings].present? ? :settings : :edit # edit page is only page with free form fields. other forms are less probable to have errors

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So value: 'true' is just to make #present? return true in case there are no fields? Could you explain a little bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is another thing related to the Formtastic upgrade. At the previous version, that commit button was returning true by default, but after the upgrade we have to add the value: 'true' so the user stays at :settings, which was part of the issue, the user being redirected to :edit when sending the form with an invalid URL.