-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
bitECS: Fix move permissions #6253
Conversation
src/utils/permissions-utils.js
Outdated
(!isPinned || window.APP.hubChannel.can("pin_objects")) && | ||
(!isPen || window.APP.hubChannel.can("spawn_drawing"))) | ||
); | ||
export function canMove(elOrEid) { |
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.
As I mentioned somewhere else, I don't prefer elOrEid
style because I think it's an error prone. Explicitly separating functions would be clearer and simpler.
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.
The one thing I like about the elOrEid approach is that avoids branching in a lot of places when the function is used across the codebase. In this case canMove
is only used in a couple of places so I think it's fine to duplicate the function.
@takahirox I've separated the functions and also re-enable a commented canMove in |
return ( | ||
hasComponent(APP.world, HoldableButton, eid) || | ||
(APP.hubChannel.can("spawn_and_move_media") && (!isPinned(eid) || APP.hubChannel.can("pin_objects"))) | ||
); |
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.
Review note: Honestly I'm not really familiar well enough with permission check but it looks based on utils/permission-utils.js
so I want to approve for now.
Is this related to #6250? |
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.
Approves once #6253 (comment) will be clear
@takahirox yes, it's related to that, otherwise you could move pinned objects. |
OK, good to go |
Fixes #6250
This PR fixes the moving permission for media.