Skip to content

Commit

Permalink
web/satellite: allow free users to invite if billing features disabled
Browse files Browse the repository at this point in the history
This change ensures that the user is never prompted to upgrade when
attempting to invite project members if billing features are configured
to be disabled.

Change-Id: I1c49351b00c0e378da24ad080fd1d3b078c97c71
  • Loading branch information
jewharton authored and Storj Robot committed Oct 20, 2023
1 parent a6222af commit 1d5ea2d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions satellite/console/config.go
Expand Up @@ -26,6 +26,7 @@ type Config struct {
UserBalanceForUpgrade int64 `help:"amount of base units of US micro dollars needed to upgrade user's tier status" default:"10000000"`
PlacementEdgeURLOverrides PlacementEdgeURLOverrides `help:"placement-specific edge service URL overrides in the format {\"placementID\": {\"authService\": \"...\", \"publicLinksharing\": \"...\", \"internalLinksharing\": \"...\"}, \"placementID2\": ...}"`
BlockExplorerURL string `help:"url of the transaction block explorer" default:"https://etherscan.io/"`
BillingFeaturesEnabled bool `help:"indicates if billing features should be enabled" default:"true"`
UsageLimits UsageLimitsConfig
Captcha CaptchaConfig
Session SessionConfig
Expand Down
1 change: 0 additions & 1 deletion satellite/console/consoleweb/server.go
Expand Up @@ -111,7 +111,6 @@ type Config struct {
UseVuetifyProject bool `help:"whether to use vuetify POC project" default:"false"`
VuetifyHost string `help:"the subdomain the vuetify POC project should be hosted on" default:""`
ObjectBrowserPaginationEnabled bool `help:"whether to use object browser pagination" default:"false"`
BillingFeaturesEnabled bool `help:"indicates if billing features should be enabled" default:"true"`

OauthCodeExpiry time.Duration `help:"how long oauth authorization codes are issued for" default:"10m"`
OauthAccessTokenExpiry time.Duration `help:"how long oauth access tokens are issued for" default:"24h"`
Expand Down
2 changes: 1 addition & 1 deletion satellite/console/service.go
Expand Up @@ -3775,7 +3775,7 @@ func (s *Service) inviteProjectMembers(ctx context.Context, sender *User, projec
}
projectID = isMember.project.ID

if !(s.config.FreeTierInvitesEnabled || sender.PaidTier) {
if s.config.BillingFeaturesEnabled && !(s.config.FreeTierInvitesEnabled || sender.PaidTier) {
return nil, ErrNotPaidTier.New(paidTierInviteErrMsg)
}

Expand Down
3 changes: 2 additions & 1 deletion web/satellite/src/components/modals/AddTeamMemberModal.vue
Expand Up @@ -116,7 +116,8 @@ const formError = computed<string | boolean>(() => {
* Returns whether the user should upgrade to pro tier before inviting.
*/
const needsUpgrade = computed<boolean>(() => {
return !(usersStore.state.user.paidTier || configStore.state.config.freeTierInvitesEnabled);
const config = configStore.state.config;
return config.billingFeaturesEnabled && !(usersStore.state.user.paidTier || config.freeTierInvitesEnabled);
});
/**
Expand Down
Expand Up @@ -166,7 +166,8 @@ const emailRules: ValidationRule<string>[] = [
* Returns whether the user should upgrade to pro tier before inviting.
*/
const needsUpgrade = computed<boolean>(() => {
return !(usersStore.state.user.paidTier || configStore.state.config.freeTierInvitesEnabled);
const config = configStore.state.config;
return config.billingFeaturesEnabled && !(usersStore.state.user.paidTier || config.freeTierInvitesEnabled);
});
/**
Expand Down

0 comments on commit 1d5ea2d

Please sign in to comment.