Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions web/core/layouts/auth-layout/project-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ export const ProjectAuthWrapper: FC<IProjectAuthWrapper> = observer((props) => {

// derived values
const projectExists = projectId ? getProjectById(projectId.toString()) : null;
const hasPermissionToCurrentProject = projectId
? allowPermissions(
[EUserPermissions.ADMIN, EUserPermissions.MEMBER, EUserPermissions.GUEST],
EUserPermissionsLevel.PROJECT
)
: undefined;
const hasPermissionToCurrentProject = allowPermissions(
[EUserPermissions.ADMIN, EUserPermissions.MEMBER, EUserPermissions.GUEST],
EUserPermissionsLevel.PROJECT,
workspaceSlug.toString(),
projectId.toString()
);

// check if the project member apis is loading
if (!projectMemberInfo && projectId && hasPermissionToCurrentProject === null)
Expand Down
4 changes: 3 additions & 1 deletion web/core/store/user/permissions.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ export class UserPermissionStore implements IUserPermissionStore {
joinProject = async (workspaceSlug: string, projectId: string): Promise<void | undefined> => {
try {
const response = await userService.joinProject(workspaceSlug, [projectId]);
const projectMemberRole = this.workspaceInfoBySlug(workspaceSlug)?.role ?? EUserPermissions.MEMBER;
if (response) {
runInAction(() => {
set(this.workspaceProjectsPermissions, [workspaceSlug, projectId], response);
set(this.workspaceProjectsPermissions, [workspaceSlug, projectId], projectMemberRole);
});
}
return response;
Expand All @@ -267,6 +268,7 @@ export class UserPermissionStore implements IUserPermissionStore {
runInAction(() => {
unset(this.workspaceProjectsPermissions, [workspaceSlug, projectId]);
unset(this.projectUserInfo, [workspaceSlug, projectId]);
unset(this.store.projectRoot.project.projectMap, [projectId]);
});
} catch (error) {
console.error("Error user leaving the project", error);
Expand Down