Bug 1410856

Summary: URLs might not be generated properly due to string conversion issue
Product: Red Hat CloudForms Management Engine Reporter: Satoe Imaishi <simaishi>
Component: UI - OPSAssignee: Martin Hradil <mhradil>
Status: CLOSED CURRENTRELEASE QA Contact: Satyajit Bulage <sbulage>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.7.0CC: hkataria, jhardy, mpovolny, obarenbo, sbulage
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.8.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1411362 (view as bug list) Environment:
Last Closed: 2017-06-12 16:12:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1411362    

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: 5.8.0.9-alpha2.20170404195944_1d7ece4