-
Notifications
You must be signed in to change notification settings - Fork 143
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
Fix custom actions hrefs #252
Fix custom actions hrefs #252
Conversation
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.
result = {attr => normalize_attr(attr, value)} | ||
# set nil vtype above to "#{type}/#{resource.id}/#{attr}" to support id normalization | ||
[value, result] | ||
end | ||
|
||
# | ||
# WARNING: This is a hack. |
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.
Prefer HACK:
as a lead-in to the comment. HACK:
(same with TODO:
and FIXME:
) are recognized by a lot of IDEs and tools to allow you to keep a checklist of things to go back to.
See
# HACK: Format attrs to use accepts_nested_attributes_for (Entitlements) |
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.
I love that # HACK:
is the official way to do it.
@imtayadeway looks good for a HACK 😉 Can you fix the spec rubocop above since that's most likely staying around. And since you're updating, can you update the comment to the "official" HACK: prefix ? Thanks. |
Because custom actions are represented as a plain hash in the model, we lose all context about the type of object we must add an href to in the normalization process. This process tries, in lieu of this context, to guess what the href path should look like, and is incorrectly linking these objects to the parent object's API (e.g. generic objects, services, etc..). Refactoring all of normalization to get the proper context will be necessary in order to fix this correctly. Instead, we intercept the result here, adding the correct hrefs, which will not be overwritten later. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1518297
4aa3ac0
to
76db03e
Compare
Checked commit imtayadeway@76db03e with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Thanks @imtayadeway for fixing this 🎵 |
Fix custom actions hrefs (cherry picked from commit 8a3e3cd) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1527564
Gaprindashvili backport details:
|
Because custom actions are represented as a plain hash in the model,
we lose all context about the type of object we must add an href to in
the normalization process. This process tries, in lieu of this
context, to guess what the href path should look like, and is
incorrectly linking these objects to the parent object's
API (e.g. generic objects, services, etc..). Refactoring all of
normalization to get the proper context will be necessary in order to
fix this correctly. Instead, we intercept the result here, adding the
correct hrefs, which will not be overwritten later.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1518297