Skip to content

Commit

Permalink
Merge pull request #10988 from owncloud/perf-function-complexity
Browse files Browse the repository at this point in the history
perf: early return space member checks
  • Loading branch information
JammingBen authored Jun 4, 2024
2 parents c75d404 + 16bee48 commit d953434
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 d953434

Please sign in to comment.