Skip to content

Commit e4b7f8d

Browse files
authored
fix(search): hide other's draft (#8548)
* fix(search): hide other's draft * fix * Remove paddle * lint * fix ts issue * remove unused import * remove unused import * lint
1 parent 7f35c51 commit e4b7f8d

File tree

9 files changed

+72
-40
lines changed

9 files changed

+72
-40
lines changed

.codesandbox/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"app:fast:stream": {
3636
"name": "Application (fast + stream)",
3737
"command": "yarn start:fast:stream",
38-
"runAtStart": true,
38+
"runAtStart": false,
3939
"preview": {
4040
"port": 3000
4141
},

packages/app/src/app/components/WorkspaceSetup/steps/SelectWorkspace.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import React, { useState } from 'react';
22
import { Button, Stack } from '@codesandbox/components';
33
import { useActions, useAppState } from 'app/overmind';
4-
import {
5-
SubscriptionPaymentProvider,
6-
SubscriptionStatus,
7-
TeamMemberAuthorization,
8-
} from 'app/graphql/types';
4+
import { SubscriptionStatus, TeamMemberAuthorization } from 'app/graphql/types';
95
import { useURLSearchParams } from 'app/hooks/useURLSearchParams';
106
import { InputSelect } from 'app/components/dashboard/InputSelect';
117
import { useHistory } from 'react-router-dom';
@@ -34,11 +30,6 @@ export const SelectWorkspace: React.FC<StepProps> = ({
3430
ua.authorization === TeamMemberAuthorization.Admin
3531
)
3632
)
37-
.filter(
38-
// Filter out paddle teams (legacy)
39-
t =>
40-
t.subscription?.paymentProvider !== SubscriptionPaymentProvider.Paddle
41-
)
4233
.filter(
4334
// Filter out teams that are on ubb pro already
4435
t =>

packages/app/src/app/graphql/types.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,6 @@ export enum SubscriptionOrigin {
11251125
}
11261126

11271127
export enum SubscriptionPaymentProvider {
1128-
Paddle = 'PADDLE',
11291128
Stripe = 'STRIPE',
11301129
}
11311130

@@ -2013,6 +2012,7 @@ export type RootMutationType = {
20132012
* with Stripe in a way that is more appropriate for a mutation than a query.
20142013
*/
20152014
previewConvertToUsageBilling: InvoicePreview;
2015+
/** @deprecated Subscription management no longer supported via GraphQL */
20162016
previewUpdateSubscriptionBillingInterval: BillingPreview;
20172017
reactivateSubscription: ProSubscription;
20182018
redeemSandboxInvitation: Invitation;
@@ -2167,8 +2167,12 @@ export type RootMutationType = {
21672167
* Not passing a specific argument will leave it unchanged, explicitly passing `null` will revert it to the default.
21682168
*/
21692169
updateSandboxSettings: SandboxSettings;
2170-
/** update subscription details (not billing details) */
2170+
/**
2171+
* update subscription details (not billing details)
2172+
* @deprecated Subscription management no longer supported via GraphQL
2173+
*/
21712174
updateSubscription: ProSubscription;
2175+
/** @deprecated Subscription management no longer supported via GraphQL */
21722176
updateSubscriptionBillingInterval: ProSubscription;
21732177
/**
21742178
* Update an active usage-based billing subscription.
@@ -2273,7 +2277,6 @@ export type RootMutationTypeCreateCollectionArgs = {
22732277
};
22742278

22752279
export type RootMutationTypeCreateCommentArgs = {
2276-
codeReference: InputMaybe<CodeReference>;
22772280
codeReferences: InputMaybe<Array<CodeReference>>;
22782281
content: Scalars['String'];
22792282
id: InputMaybe<Scalars['ID']>;
@@ -4558,6 +4561,7 @@ export type SandboxFragmentDashboardFragment = {
45584561
path: string;
45594562
id: any | null;
45604563
} | null;
4564+
author: { __typename?: 'User'; username: string } | null;
45614565
permissions: {
45624566
__typename?: 'SandboxProtectionSettings';
45634567
preventSandboxLeaving: boolean;
@@ -4621,6 +4625,7 @@ export type RepoFragmentDashboardFragment = {
46214625
path: string;
46224626
id: any | null;
46234627
} | null;
4628+
author: { __typename?: 'User'; username: string } | null;
46244629
permissions: {
46254630
__typename?: 'SandboxProtectionSettings';
46264631
preventSandboxLeaving: boolean;
@@ -4880,6 +4885,7 @@ export type BranchFragment = {
48804885
contribution: boolean;
48814886
lastAccessedAt: string | null;
48824887
upstream: boolean;
4888+
owner: { __typename?: 'User'; username: string } | null;
48834889
project: {
48844890
__typename?: 'Project';
48854891
repository: {
@@ -4900,6 +4906,7 @@ export type BranchWithPrFragment = {
49004906
contribution: boolean;
49014907
lastAccessedAt: string | null;
49024908
upstream: boolean;
4909+
owner: { __typename?: 'User'; username: string } | null;
49034910
project: {
49044911
__typename?: 'Project';
49054912
repository: {
@@ -4945,6 +4952,7 @@ export type ProjectWithBranchesFragment = {
49454952
contribution: boolean;
49464953
lastAccessedAt: string | null;
49474954
upstream: boolean;
4955+
owner: { __typename?: 'User'; username: string } | null;
49484956
project: {
49494957
__typename?: 'Project';
49504958
repository: {
@@ -5152,6 +5160,7 @@ export type AddToFolderMutation = {
51525160
path: string;
51535161
id: any | null;
51545162
} | null;
5163+
author: { __typename?: 'User'; username: string } | null;
51555164
permissions: {
51565165
__typename?: 'SandboxProtectionSettings';
51575166
preventSandboxLeaving: boolean;
@@ -5205,6 +5214,7 @@ export type MoveToTrashMutation = {
52055214
path: string;
52065215
id: any | null;
52075216
} | null;
5217+
author: { __typename?: 'User'; username: string } | null;
52085218
permissions: {
52095219
__typename?: 'SandboxProtectionSettings';
52105220
preventSandboxLeaving: boolean;
@@ -5259,6 +5269,7 @@ export type ChangePrivacyMutation = {
52595269
path: string;
52605270
id: any | null;
52615271
} | null;
5272+
author: { __typename?: 'User'; username: string } | null;
52625273
permissions: {
52635274
__typename?: 'SandboxProtectionSettings';
52645275
preventSandboxLeaving: boolean;
@@ -5313,6 +5324,7 @@ export type ChangeFrozenMutation = {
53135324
path: string;
53145325
id: any | null;
53155326
} | null;
5327+
author: { __typename?: 'User'; username: string } | null;
53165328
permissions: {
53175329
__typename?: 'SandboxProtectionSettings';
53185330
preventSandboxLeaving: boolean;
@@ -5367,6 +5379,7 @@ export type _RenameSandboxMutation = {
53675379
path: string;
53685380
id: any | null;
53695381
} | null;
5382+
author: { __typename?: 'User'; username: string } | null;
53705383
permissions: {
53715384
__typename?: 'SandboxProtectionSettings';
53725385
preventSandboxLeaving: boolean;
@@ -5860,6 +5873,7 @@ export type RecentlyDeletedTeamSandboxesQuery = {
58605873
path: string;
58615874
id: any | null;
58625875
} | null;
5876+
author: { __typename?: 'User'; username: string } | null;
58635877
permissions: {
58645878
__typename?: 'SandboxProtectionSettings';
58655879
preventSandboxLeaving: boolean;
@@ -5928,6 +5942,7 @@ export type SandboxesByPathQuery = {
59285942
path: string;
59295943
id: any | null;
59305944
} | null;
5945+
author: { __typename?: 'User'; username: string } | null;
59315946
permissions: {
59325947
__typename?: 'SandboxProtectionSettings';
59335948
preventSandboxLeaving: boolean;
@@ -5988,6 +6003,7 @@ export type TeamDraftsQuery = {
59886003
path: string;
59896004
id: any | null;
59906005
} | null;
6006+
author: { __typename?: 'User'; username: string } | null;
59916007
permissions: {
59926008
__typename?: 'SandboxProtectionSettings';
59936009
preventSandboxLeaving: boolean;
@@ -6081,6 +6097,7 @@ export type GetTeamReposQuery = {
60816097
path: string;
60826098
id: any | null;
60836099
} | null;
6100+
author: { __typename?: 'User'; username: string } | null;
60846101
permissions: {
60856102
__typename?: 'SandboxProtectionSettings';
60866103
preventSandboxLeaving: boolean;
@@ -6287,6 +6304,7 @@ export type _SearchTeamSandboxesQuery = {
62876304
path: string;
62886305
id: any | null;
62896306
} | null;
6307+
author: { __typename?: 'User'; username: string } | null;
62906308
permissions: {
62916309
__typename?: 'SandboxProtectionSettings';
62926310
preventSandboxLeaving: boolean;
@@ -6345,6 +6363,7 @@ export type RecentlyAccessedSandboxesQuery = {
63456363
path: string;
63466364
id: any | null;
63476365
} | null;
6366+
author: { __typename?: 'User'; username: string } | null;
63486367
permissions: {
63496368
__typename?: 'SandboxProtectionSettings';
63506369
preventSandboxLeaving: boolean;
@@ -6370,6 +6389,7 @@ export type RecentlyAccessedBranchesQuery = {
63706389
contribution: boolean;
63716390
lastAccessedAt: string | null;
63726391
upstream: boolean;
6392+
owner: { __typename?: 'User'; username: string } | null;
63736393
project: {
63746394
__typename?: 'Project';
63756395
repository: {
@@ -6432,6 +6452,7 @@ export type SharedWithMeSandboxesQuery = {
64326452
path: string;
64336453
id: any | null;
64346454
} | null;
6455+
author: { __typename?: 'User'; username: string } | null;
64356456
permissions: {
64366457
__typename?: 'SandboxProtectionSettings';
64376458
preventSandboxLeaving: boolean;
@@ -6581,6 +6602,7 @@ export type ContributionBranchesQuery = {
65816602
contribution: boolean;
65826603
lastAccessedAt: string | null;
65836604
upstream: boolean;
6605+
owner: { __typename?: 'User'; username: string } | null;
65846606
project: {
65856607
__typename?: 'Project';
65866608
repository: {
@@ -6645,6 +6667,7 @@ export type RepositoryByDetailsQuery = {
66456667
contribution: boolean;
66466668
lastAccessedAt: string | null;
66476669
upstream: boolean;
6670+
owner: { __typename?: 'User'; username: string } | null;
66486671
project: {
66496672
__typename?: 'Project';
66506673
repository: {
@@ -7026,6 +7049,7 @@ export type TeamSidebarDataQuery = {
70267049
path: string;
70277050
id: any | null;
70287051
} | null;
7052+
author: { __typename?: 'User'; username: string } | null;
70297053
permissions: {
70307054
__typename?: 'SandboxProtectionSettings';
70317055
preventSandboxLeaving: boolean;

packages/app/src/app/hooks/useWorkspaceSubscription.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
CurrentTeamInfoFragmentFragment,
3-
SubscriptionPaymentProvider,
43
SubscriptionStatus,
54
} from 'app/graphql/types';
65
import { useAppState } from 'app/overmind';
@@ -52,15 +51,11 @@ export const useWorkspaceSubscription = (): WorkspaceSubscriptionReturn => {
5251

5352
const hasPaymentMethod = subscription.paymentMethodAttached;
5453

55-
const isPaddle =
56-
subscription.paymentProvider === SubscriptionPaymentProvider.Paddle;
57-
5854
return {
5955
subscription,
6056
isPro,
6157
isFree,
6258
hasPaymentMethod,
63-
isPaddle,
6459
};
6560
};
6661

@@ -69,15 +64,13 @@ const NO_WORKSPACE = {
6964
isPro: undefined,
7065
isFree: undefined,
7166
hasPaymentMethod: undefined,
72-
isPaddle: undefined,
7367
};
7468

7569
const NO_SUBSCRIPTION = {
7670
subscription: null,
7771
isPro: false,
7872
isFree: true,
7973
hasPaymentMethod: false,
80-
isPaddle: false,
8174
};
8275

8376
export type WorkspaceSubscriptionReturn =
@@ -88,5 +81,4 @@ export type WorkspaceSubscriptionReturn =
8881
isPro: boolean;
8982
isFree: boolean;
9083
hasPaymentMethod: boolean;
91-
isPaddle: boolean;
9284
};

packages/app/src/app/overmind/effects/gql/dashboard/fragments.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export const sandboxFragmentDashboard = gql`
4242
}
4343
4444
authorId
45+
author {
46+
username
47+
}
4548
teamId
4649
4750
permissions {
@@ -295,6 +298,9 @@ export const branchFragment = gql`
295298
contribution
296299
lastAccessedAt
297300
upstream
301+
owner {
302+
username
303+
}
298304
project {
299305
repository {
300306
... on GitHubRepository {
@@ -317,6 +323,9 @@ export const branchWithPRFragment = gql`
317323
name
318324
contribution
319325
lastAccessedAt
326+
owner {
327+
username
328+
}
320329
upstream
321330
project {
322331
repository {

packages/app/src/app/pages/Dashboard/Content/routes/Recent/Banners/LegacyProConvertBanner.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ import { upgradeUrl } from '@codesandbox/common/lib/utils/url-generator/dashboar
1313
import { useAppState } from 'app/overmind';
1414
import { useWorkspaceAuthorization } from 'app/hooks/useWorkspaceAuthorization';
1515
import { docsUrl } from '@codesandbox/common/lib/utils/url-generator';
16-
import { useWorkspaceSubscription } from 'app/hooks/useWorkspaceSubscription';
1716
import { BannerProps } from './types';
1817

1918
export const LegacyProConvertBanner: React.FC<BannerProps> = ({
2019
onDismiss,
2120
}) => {
2221
const { activeTeam } = useAppState();
2322
const { isAdmin } = useWorkspaceAuthorization();
24-
const { isPaddle } = useWorkspaceSubscription();
2523

2624
return (
2725
<Banner
@@ -44,7 +42,7 @@ export const LegacyProConvertBanner: React.FC<BannerProps> = ({
4442
</Stack>
4543

4644
<Stack align="center" gap={6}>
47-
{isAdmin && !isPaddle && (
45+
{isAdmin && (
4846
<RouterLink
4947
to={upgradeUrl({
5048
workspaceId: activeTeam,
@@ -62,15 +60,7 @@ export const LegacyProConvertBanner: React.FC<BannerProps> = ({
6260
</Button>
6361
</RouterLink>
6462
)}
65-
{isAdmin && isPaddle && (
66-
<Button
67-
as="a"
68-
href="mailto:[email protected]?subject=Convert to usage based billing"
69-
autoWidth
70-
>
71-
Contact us
72-
</Button>
73-
)}
63+
7464
<Link
7565
href={docsUrl(
7666
'/learn/plans/workspace#managing-teams-and-subscriptions'

packages/app/src/app/pages/Dashboard/Content/routes/Search/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ export const SearchComponent = () => {
1515
const {
1616
activeTeam,
1717
dashboard: { getFilteredSandboxes },
18+
user,
1819
} = useAppState();
1920
const location = useLocation();
2021
const query = new URLSearchParams(location.search).get('query');
2122
const [items] = useGetItems({
2223
query,
24+
username: user?.username,
2325
getFilteredSandboxes,
2426
});
2527
const pageType: PageTypes = 'search';

0 commit comments

Comments
 (0)