Skip to content

Commit

Permalink
satellite/console,web/satellite: Fix project limit checking
Browse files Browse the repository at this point in the history
* Fixes backend to use only a user's owned projects to determine if the
  user has hit the project limit
* Makes frontend logic consistent (and simpler) for checking whether to
  send user to the "Create Project" modal or the "upgrade account or
  request limit increase" modal

Before this change, projects that a user is a member of would be
included in determining whether the user could create a project. Also,
the "create project" button in the projects menu in the navbar of the UI
did not enable a free tier user to create a new project, even if they
had not hit their limits.

Change-Id: Ia776eb627ca37b83f5bc63bed83ee83c9f7cc789
  • Loading branch information
mobyvb authored and Storj Robot committed Jul 10, 2023
1 parent 4e876fb commit 4108aa7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion satellite/console/service.go
Expand Up @@ -2930,7 +2930,7 @@ func (s *Service) checkProjectLimit(ctx context.Context, userID uuid.UUID) (curr
return 0, Error.Wrap(err)
}

projects, err := s.GetUsersProjects(ctx)
projects, err := s.store.Projects().GetOwn(ctx, userID)
if err != nil {
return 0, Error.Wrap(err)
}
Expand Down
6 changes: 3 additions & 3 deletions web/satellite/src/components/navigation/ProjectSelection.vue
Expand Up @@ -383,11 +383,11 @@ function onCreateLinkClick(): void {
const user: User = userStore.state.user;
const ownProjectsCount: number = projectsStore.projectsCount(user.id);
if (!user.paidTier || user.projectLimit === ownProjectsCount) {
appStore.updateActiveModal(MODALS.createProjectPrompt);
} else {
if (user.projectLimit > ownProjectsCount) {
analytics.pageVisit(RouteConfig.CreateProject.path);
appStore.updateActiveModal(MODALS.newCreateProject);
} else {
appStore.updateActiveModal(MODALS.createProjectPrompt);
}
}
Expand Down
Expand Up @@ -163,11 +163,11 @@ function onCreateProjectClicked(): void {
const user: User = usersStore.state.user;
const ownProjectsCount: number = projectsStore.projectsCount(user.id);
if (!user.paidTier && user.projectLimit === ownProjectsCount) {
appStore.updateActiveModal(MODALS.createProjectPrompt);
} else {
if (user.projectLimit > ownProjectsCount) {
analytics.pageVisit(RouteConfig.CreateProject.path);
appStore.updateActiveModal(MODALS.newCreateProject);
} else {
appStore.updateActiveModal(MODALS.createProjectPrompt);
}
}
</script>
Expand Down

0 comments on commit 4108aa7

Please sign in to comment.