-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
REF - Use function to get component name from permission #22688
Conversation
(Standard links)
|
5bee1fd
to
3ac2f8d
Compare
Retest this please |
I can take a look. |
Looks ok. One sanity check I did was to compare the before/after output of This function also appears to only be called from one place in universe (the same file), so it limits the scope. I'm ok to merge just might be worth making the function private. |
3ac2f8d
to
e9a48f3
Compare
@@ -189,17 +176,10 @@ public static function checkPermission($permissions, $operator) { | |||
} | |||
} | |||
|
|||
if (!$showDashlet && !$hasPermission) { | |||
return FALSE; | |||
} |
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.
Wow, a triple negative! I wonder if there's a simpler way to write that?
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.
Hehe. Seems there isn't not a way to avoid it.
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 wouldn't be unsurprised if we couldn't simplify it.
Ok @demeritcowboy I changed the function to be private and added some additional cleanup for your reviewing pleasure :) |
Overview
Refactors some long-winded code which was attempting to do what an existing function does better
Before
Try to guess component name from permission name, based on string fudgery
After
Use a function which does it without guessing
Comments
I'm fairly certain this change is correct, but someone else should look at it to ensure I'm not missing some important difference between the existing code (silly as it was) and the new function.