Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
f6a038b3
Commit
f6a038b3
authored
Mar 26, 2019
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create a new file if URL references non-existent one
parent
d0a0d3d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
app/assets/javascripts/ide/stores/actions/project.js
app/assets/javascripts/ide/stores/actions/project.js
+5
-0
spec/javascripts/ide/stores/actions/project_spec.js
spec/javascripts/ide/stores/actions/project_spec.js
+17
-0
No files found.
app/assets/javascripts/ide/stores/actions/project.js
View file @
f6a038b3
...
@@ -147,6 +147,11 @@ export const openBranch = ({ dispatch, state }, { projectId, branchId, basePath
...
@@ -147,6 +147,11 @@ export const openBranch = ({ dispatch, state }, { projectId, branchId, basePath
if
(
treeEntry
)
{
if
(
treeEntry
)
{
dispatch
(
'
handleTreeEntryAction
'
,
treeEntry
);
dispatch
(
'
handleTreeEntryAction
'
,
treeEntry
);
}
else
{
dispatch
(
'
createTempEntry
'
,
{
name
:
path
,
type
:
'
blob
'
,
});
}
}
}
}
})
})
...
...
spec/javascripts/ide/stores/actions/project_spec.js
View file @
f6a038b3
...
@@ -279,5 +279,22 @@ describe('IDE store project actions', () => {
...
@@ -279,5 +279,22 @@ describe('IDE store project actions', () => {
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
creates a new file supplied via URL if the file does not exist yet
'
,
done
=>
{
openBranch
(
store
,
{
...
branch
,
basePath
:
'
not-existent.md
'
})
.
then
(()
=>
{
expect
(
store
.
dispatch
).
not
.
toHaveBeenCalledWith
(
'
handleTreeEntryAction
'
,
jasmine
.
anything
(),
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
createTempEntry
'
,
{
name
:
'
not-existent.md
'
,
type
:
'
blob
'
,
});
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment