Skip to content

Commit

Permalink
fix(claims): 🚑 Edit claim images only when owner or admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Nudelsuppe42 committed Apr 23, 2024
1 parent f6ce52a commit a8d6e41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/map/ClaimDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export function ClaimDrawer(props: ClaimDrawerProps) {
<ClaimDrawerImages
id={props.id}
images={data.images}
editable={data?.owner?.id == user.user?.id}
editable={
user.isLoggedIn &&
(data?.owner?.id == user.user?.id || user.hasPermission('admin.admin'))
}
t={t}
/>
)}
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const useUser = () => {
const user = {
user: data,
token: session.data?.accessToken,
isLoggedIn: session.status === 'authenticated',
isLoading: session.status === 'loading' && isLoading,
refresh: () => mutate('/account'),
hasPermission: (p: string, buildteam?: string) => {
Expand Down

0 comments on commit a8d6e41

Please sign in to comment.