Skip to content

Commit

Permalink
satellite/web: hide project details link for project members
Browse files Browse the repository at this point in the history
This change hides the project details link, introduced for the issue
linked below, if the user is only a member and not the owner of the
project.

Related: #5930

Change-Id: If6b0817dfa32f2f661629cc158eb4fb44dfe9ffc
  • Loading branch information
wilfred-asomanii authored and Storj Robot committed Jun 9, 2023
1 parent 8a01bcf commit 8f7c59d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion web/satellite/src/components/navigation/MobileNavigation.vue
Expand Up @@ -47,7 +47,7 @@
<p class="project-selection__dropdown__items__choice__unselected">{{ project.name }}</p>
</div>
</div>
<div v-if="isAllProjectsDashboard" tabindex="0" class="project-selection__dropdown__link-container" @click.stop="onProjectDetailsClick" @keyup.enter="onProjectDetailsClick">
<div v-if="isAllProjectsDashboard && isProjectOwner" tabindex="0" class="project-selection__dropdown__link-container" @click.stop="onProjectDetailsClick" @keyup.enter="onProjectDetailsClick">
<InfoIcon />
<p class="project-selection__dropdown__link-container__label">Project Details</p>
</div>
Expand Down Expand Up @@ -259,6 +259,13 @@ const isAccountDropdownShown = ref<boolean>(false);
const isOpened = ref<boolean>(false);
const isLoading = ref<boolean>(false);
/*
* Whether the user is the owner of the selected project.
*/
const isProjectOwner = computed((): boolean => {
return usersStore.state.user.id === projectsStore.state.selectedProject.ownerId;
});
/**
* Indicates if all projects dashboard should be used.
*/
Expand Down
9 changes: 8 additions & 1 deletion web/satellite/src/components/navigation/ProjectSelection.vue
Expand Up @@ -42,7 +42,7 @@
<p class="project-selection__dropdown__items__choice__unselected">{{ project.name }}</p>
</div>
</div>
<div v-if="isAllProjectsDashboard" tabindex="0" class="project-selection__dropdown__link-container" @click.stop="onProjectDetailsClick" @keyup.enter="onProjectDetailsClick">
<div v-if="isAllProjectsDashboard && isProjectOwner" tabindex="0" class="project-selection__dropdown__link-container" @click.stop="onProjectDetailsClick" @keyup.enter="onProjectDetailsClick">
<InfoIcon />
<p class="project-selection__dropdown__link-container__label">Project Details</p>
</div>
Expand Down Expand Up @@ -131,6 +131,13 @@ const isOnboardingTour = computed((): boolean => {
return route.path.includes(RouteConfig.OnboardingTour.path);
});
/*
* Whether the user is the owner of the selected project.
*/
const isProjectOwner = computed((): boolean => {
return userStore.state.user.id === projectsStore.state.selectedProject.ownerId;
});
/**
* Indicates if all projects dashboard is enabled.
*/
Expand Down

0 comments on commit 8f7c59d

Please sign in to comment.