Skip to content

Commit 685062c

Browse files
committed
Fix PR modal message
1 parent 766c9da commit 685062c

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

packages/app/src/app/pages/common/Modals/PRModal/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ function PRModal({ store }) {
66
let result = null;
77

88
if (!store.git.isCreatingPr) {
9-
const pr = store.git.pr;
10-
const git = store.editor.currentSandbox.originalGit;
11-
const newUrl = `https://github.com/${git.username}/${git.repo}/compare/${
12-
git.branch
13-
}...${store.user.username}:${pr.newBranch}?expand=1`;
9+
const newUrl = store.git.pr.prURL;
1410

1511
result = (
1612
<div>

packages/app/src/app/store/modules/git/actions.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
export function openPr({ state, browser }) {
2-
const pr = state.get('git.pr');
3-
const user = state.get('user');
4-
const git = state.get('editor.currentSandbox.originalGit');
5-
6-
const url = `https://github.com/${git.username}/${git.repo}/compare/${
7-
git.branch
8-
}...${user.username}:${pr.newBranch}?expand=1`;
2+
const url = state.get('git.pr.prURL');
93

104
browser.openWindow(url);
115
}
@@ -82,3 +76,15 @@ export function saveGithubData({ api, state, props }) {
8276
export function redirectToGithubSandbox({ props, router }) {
8377
router.updateSandboxUrl({ git: props.git });
8478
}
79+
80+
export function setPRURL({ state }) {
81+
const pr = state.get('git.pr');
82+
const user = state.get('user');
83+
const git = state.get('editor.currentSandbox.originalGit');
84+
85+
const url = `https://github.com/${git.username}/${git.repo}/compare/${
86+
git.branch
87+
}...${user.username}:${pr.newBranch}?expand=1`;
88+
89+
state.set('git.pr.prURL', url);
90+
}

packages/app/src/app/store/modules/git/model.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default {
3939
newBranch: types.string,
4040
sha: types.string,
4141
url: types.string,
42+
prURL: types.maybe(types.string),
4243
})
4344
),
4445
isCommiting: types.boolean,

packages/app/src/app/store/modules/git/sequences.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ export const createPr = [
6060
actions.createPr,
6161
set(state`git.pr`, props`pr`),
6262
set(state`git.isCreatingPr`, false),
63+
actions.setPRURL,
6364
wait(3000),
6465
actions.openPr,
6566
set(state`git.subject`, ''),
6667
set(state`git.description`, ''),
68+
set(state`git.originalGitChanges`, null),
6769
actions.redirectToPr,
6870
];

0 commit comments

Comments
 (0)