-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Refactor group permission function. #332
Conversation
Visit the preview URL for this PR (updated for commit 25287db): https://sharezone-test--pr332-course-permission-fu-vc3kafwv.web.app (expires Fri, 13 Jan 2023 17:15:54 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b |
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.
LGTM 👍
Would be great to also add a few tests for the group_permission.dart
file, but we can also do this later.
Since I didn't touch any behavior (just deleted unused code) and the code is really dead simple I don't see that much reason to write tests. They would just mirror the implementation. I feel like it would make more sense to write tests in the future that test this function through the code that uses it. |
⬇️ Generated builds by Codemagic for commit 25287db ⬇️ Note: Only Sharezone team members are able to install the iOS app.
|
I stumbled on the
requestPermission
function in our code which was used to check if a user can perform a certain action, e.g. adding homework or changing course settings.This function was weirdly named and had logic for enum values which were not in use anymore.
I changed the function to an extension method on
MemberRole
and removed the unused enums.Additionally I moved the files from the
additional
togroups
folder.Lastly I renamed the function
isUserAdminOrOwnerFromCourse
toisUserAdminOrOwnerOfGroup
in the same file.