Skip to content

Commit 222d560

Browse files
committed
Fix forking github sandboxes
Fixes codesandbox#3514
1 parent 505d678 commit 222d560

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/app/src/app/overmind/factories.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ export const withOwnedSandbox = <T>(
8686
const sandbox = state.editor.currentSandbox;
8787
if (sandbox) {
8888
if (
89-
typeof requiredPermission !== 'undefined' &&
90-
!hasPermission(sandbox.authorization, requiredPermission)
89+
typeof requiredPermission === 'undefined'
90+
? !sandbox.owned
91+
: !hasPermission(sandbox.authorization, requiredPermission)
9192
) {
9293
if (state.editor.isForkingSandbox) {
9394
return cancelAction(context, payload);

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export const codeSaved: AsyncAction<{
174174
effects.vscode.callCallbackError(cbID);
175175
}
176176
},
177-
'write_project'
177+
'write_code'
178178
);
179179

180180
export const onOperationApplied: Action<{

packages/app/src/app/overmind/utils/items.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import getTemplate from '@codesandbox/common/lib/templates';
2+
import { hasPermission } from '@codesandbox/common/lib/utils/permission';
23

34
export interface INavigationItem {
45
id: string;
@@ -116,7 +117,11 @@ export default function getItems(store: any): INavigationItem[] {
116117
items.push(DEPLOYMENT);
117118
}
118119

119-
if (store.isLoggedIn) {
120+
if (
121+
store.isLoggedIn &&
122+
currentSandbox &&
123+
hasPermission(currentSandbox.authorization, 'write_code')
124+
) {
120125
items.push(LIVE);
121126
}
122127

0 commit comments

Comments
 (0)