-
Notifications
You must be signed in to change notification settings - Fork 366
[WIP] Fix custom buttons using role names that can change #9709
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
base: master
Are you sure you want to change the base?
[WIP] Fix custom buttons using role names that can change #9709
Conversation
| edit[:new][:roles] = [old_role.id, role.id.to_s] # old roles are represented by int and new ones by string | ||
| controller.send(:button_set_record_vars, custom_button) | ||
| expect(custom_button.visibility[:roles]).to eq([old_role.name, role.name]) | ||
| expect(custom_button.visibility[:roles]).to eq([old_role.id, role.id.to_s]) |
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.
TODO: that comment on line 347 is nuts. I need to figure out if roles as strings and ints is an actual thing.
| roles.push(role.name) if role | ||
| end | ||
| button.visibility[:roles] = roles | ||
| button.visibility[:roles] = @edit[:new][:roles] |
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.
TODO: keep the lookup but drop the loop...
button.visibility[:roles] = MiqUserRole.where(:id => @edit[:new][:roles]).pluck(:id)Based on changes in ManageIQ#9709
03d702e to
725a24b
Compare
TODO:
Extract the Widget change for a followup that is based on the changes here.
Store these things in a different key such as
:role_idsMake sure any shared code in widgets / custom buttons are not broken by this change.
Research the comment regarding both string and int role ids in the
@editnew/old arrays, one for old and new values.[ ] Write a data migration to convert existing CustomButton rows with visibility columns from:
To:
Or(see the first bullet):