satellite/console,web/satellite: Fix project limit checking

* 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
This commit is contained in:
Moby von Briesen 2023-06-15 19:47:46 -04:00 committed by Storj Robot
parent 4e876fbdba
commit 4108aa72ba
3 changed files with 7 additions and 7 deletions

View File

@ -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)
}

View File

@ -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);
}
}

View File

@ -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>