Skip to content

Commit

Permalink
chore: add return types
Browse files Browse the repository at this point in the history
  • Loading branch information
rgwozdz committed Jul 19, 2023
1 parent 3a7b151 commit 728e3ea
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/discussions/src/utils/channel-permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ChannelPermission {
});
}

canPostToChannel(user: IDiscussionsUser) {
canPostToChannel(user: IDiscussionsUser): boolean {
if (this.canAnyUser(ChannelAction.WRITE_POSTS)) {
return true;
}
Expand All @@ -55,7 +55,7 @@ export class ChannelPermission {
);
}

canCreateChannel(user: IDiscussionsUser) {
canCreateChannel(user: IDiscussionsUser): boolean {
if (this.isUserUnAuthenticated(user) || this.isChannelAclEmpty) {
return false;
}
Expand All @@ -69,7 +69,7 @@ export class ChannelPermission {
);
}

canModerateChannel(user: IDiscussionsUser) {
canModerateChannel(user: IDiscussionsUser): boolean {
if (this.isUserUnAuthenticated(user)) {
return false;
}
Expand All @@ -82,7 +82,7 @@ export class ChannelPermission {
);
}

canReadChannel(user: IDiscussionsUser) {
canReadChannel(user: IDiscussionsUser): boolean {
if (this.canAnyUser(ChannelAction.READ_POSTS)) {
return true;
}
Expand Down Expand Up @@ -153,7 +153,7 @@ export class ChannelPermission {
}

return (
permissionMatchesOrgRole(permission, user.role) &&
doesPermissionAllowOrgRole(permission, user.role) &&
channelActionLookup(action).includes(permission.role)
);
});
Expand Down Expand Up @@ -252,7 +252,7 @@ function isGroupDiscussable(userGroup: IGroup): boolean {
function doesPermissionAllowGroupMemberType(
permission: IChannelAclPermission,
group: IGroup
) {
): boolean {
if (
permission.category !== AclCategory.GROUP ||
group.userMembership.memberType === "none"
Expand All @@ -268,10 +268,10 @@ function doesPermissionAllowGroupMemberType(
);
}

function permissionMatchesOrgRole(
function doesPermissionAllowOrgRole(
permission: IChannelAclPermission,
orgRole: string
) {
): boolean {
return (
permission.category === AclCategory.ORG &&
(permission.subCategory === AclSubCategory.MEMBER ||
Expand Down

0 comments on commit 728e3ea

Please sign in to comment.