-
-
Notifications
You must be signed in to change notification settings - Fork 0
Extracted permission object #2
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
Conversation
dae50b8
to
0e483b3
Compare
c69dba7
to
650f077
Compare
@RangerMauve This version of my new concept is now pretty much cleaned up and tested. Things that are missing on my list are:
|
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.
This looks great so far! Just a few small comments.
src/Permissions.ts
Outdated
} | ||
|
||
add <Input extends FeedItem> (item: Input): Input { | ||
const members = this.members.byState.added ?? emptySet as Set<MemberId> |
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 get how this could save some memory, but I'm worried it could lead to weird edge cases where the set can get modified. 🤔
src/Permissions.ts
Outdated
private readonly openRequestsByMember = new Map<MemberId, Request[]>() | ||
|
||
get isLocked (): boolean { | ||
return this.members.byState.added === undefined && this.members.byState.removed !== undefined |
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.
Could this be renamed to something a bit more verbose, it's not obvious what it does.
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 was struggling with the naming here, though I thought its a good idea to have it: basically the code allows for all members to be removed, this way the permissions/group would become unwriteable and basically enters an "archived" state. Not sure what to call 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.
What about isDestroyed
? Or is isEmpty
or something along those lines. Locked feels like the existing set of members are locked in place, or that you cannot add or remove members for some other reason as a member yourself.
Gonna merge and add the remaining items as TODOs. |
Initial work on extracted permission object. Still parts missing, so: WIP