Skip to content

Commit

Permalink
perf: early return space member checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Jun 4, 2024
1 parent 722a837 commit 16bee48
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/web-client/src/helpers/space/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,16 @@ export function buildSpace(
return urlJoin(webDavTrashUrl, path)
},
isViewer(user: User): boolean {
return this.spaceRoles.viewer.map((r) => r.isMember(user)).some(Boolean)
return this.spaceRoles.viewer.some((r) => r.isMember(user))
},
isEditor(user: User): boolean {
return this.spaceRoles.editor.map((r) => r.isMember(user)).some(Boolean)
return this.spaceRoles.editor.some((r) => r.isMember(user))
},
isManager(user: User): boolean {
return this.spaceRoles.manager.map((r) => r.isMember(user)).some(Boolean)
return this.spaceRoles.manager.some((r) => r.isMember(user))
},
isSecureViewer(user: User): boolean {
return this.spaceRoles['secure-viewer'].map((r) => r.isMember(user)).some(Boolean)
return this.spaceRoles['secure-viewer'].some((r) => r.isMember(user))
},
isMember(user: User): boolean {
return this.isViewer(user) || this.isEditor(user) || this.isManager(user)
Expand Down

0 comments on commit 16bee48

Please sign in to comment.