Skip to content

Commit

Permalink
Merge pull request #853 from OpenSourceBrain/feature/817
Browse files Browse the repository at this point in the history
Feature/817 - workspace folder icon callback + fix public workspace in my accounts
  • Loading branch information
filippomc authored Dec 21, 2023
2 parents 128606c + 729de16 commit eca2dc0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
20 changes: 18 additions & 2 deletions applications/osb-portal/src/pages/UserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ export const UserPage = (props: any) => {
return
}

const openWorkspaceUrl = (workspaceId: number) => {
navigate(`/workspace/${workspaceId}`);
};

const canEdit =
currentUser && (currentUser.id === user.id || currentUser.isAdmin);
return (
Expand Down Expand Up @@ -723,7 +727,13 @@ export const UserPage = (props: any) => {
lg={4}
xl={3}
>
<WorkspaceCard workspace={ws} user={currentUser} />
<WorkspaceCard
workspace={ws}
user={currentUser}
handleWorkspaceClick={(workspace: Workspace) =>
openWorkspaceUrl(workspace.id)
}
/>
</Grid>
);
})}
Expand All @@ -744,7 +754,13 @@ export const UserPage = (props: any) => {
lg={4}
xl={3}
>
<WorkspaceCard workspace={ws} user={currentUser} />
<WorkspaceCard
workspace={ws}
user={currentUser}
handleWorkspaceClick={(workspace: Workspace) =>
openWorkspaceUrl(workspace.id)
}
/>
</Grid>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ def filter_by_user_and_fieldkey(self, filter, user_id, show_all, q_base):
else:
# No logged in user, show only public (in case was not specified)
q_base = q_base.filter(WorkspaceEntity.publicable == True)

# if filter has user_id, then filter it with the user_id
if filter and any(field for field, condition, value in filter if field.key == "user_id"):
q_base = q_base.filter(
*[self._create_filter(*f) for f in filter if (f[0].key == "user_id")])
return q_base

def filter_by_tags(self, tags, q_base):
Expand Down

0 comments on commit eca2dc0

Please sign in to comment.