Bug 1410856 - URLs might not be generated properly due to string conversion issue
Summary: URLs might not be generated properly due to string conversion issue
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: 5.8.0
Assignee: Martin Hradil
QA Contact: Satyajit Bulage
Depends On:
Blocks: 1411362
TreeView+ depends on / blocked
Reported: 2017-01-06 15:58 UTC by Satoe Imaishi
Modified: 2017-06-12 16:12 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1411362 (view as bug list)
Last Closed: 2017-06-12 16:12:27 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)

Description Satoe Imaishi 2017-01-06 15:58:24 UTC
From PR https://github.com/ManageIQ/manageiq/pull/12475:

in 0517b67 (#11074), code like "#{foo || "new"}" got refactored to (foo.to_s || "new"), but unfortunately, that means a different thing if foo is nil. (Because nil.to_s == "" so true.)

Changing to use (foo || "new").to_s instead, which should be semantically equivalent to the original.

Without the PR, some URLs would get generated (for example) as /ops/edit/ instead of /ops/edit/new.

Comment 3 Martin Hradil 2017-01-10 14:03:50 UTC
Steps to verify:

go to Automate > Customization, Buttons accordion
click a button group
toolbar Configure > Add a new Button
scroll down to the Visibility section
in the "Show" selectpicker, select "<By Role>"
check a role checkbox and watch network requests (in the inspector Network tab, or in rails log)

expected: POST /miq_ae_customization/automate_button_field_changed/new

bad: POST /miq_ae_customization/automate_button_field_changed/

Comment 4 Satyajit Bulage 2017-04-12 12:50:40 UTC
After performing steps from Comment 3, got expected results: 
POST /miq_ae_customization/automate_button_field_changed/new

Verified Version:

Note You need to log in before you can comment on or make changes to this bug.