Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
476578cf
Unverified
Commit
476578cf
authored
Nov 14, 2018
by
Paul Kaplan
Committed by
GitHub
Nov 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2304 from paulkaplan/update-share-endpoint
Move sharing to special endpoint.
parents
805bd877
f8d59854
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
src/redux/preview.js
src/redux/preview.js
+28
-0
src/views/preview/preview.jsx
src/views/preview/preview.jsx
+5
-3
No files found.
src/redux/preview.js
View file @
476578cf
...
...
@@ -55,6 +55,10 @@ module.exports.previewReducer = (state, action) => {
projectInfo
:
action
.
info
?
action
.
info
:
{},
projectNotAvailable
:
!
action
.
info
});
case
'
UPDATE_PROJECT_INFO
'
:
return
Object
.
assign
({},
state
,
{
projectInfo
:
Object
.
assign
({},
state
.
projectInfo
,
action
.
info
)
});
case
'
SET_REMIXES
'
:
return
Object
.
assign
({},
state
,
{
remixes
:
action
.
items
...
...
@@ -182,6 +186,11 @@ module.exports.setProjectInfo = info => ({
info
:
info
});
module
.
exports
.
updateProjectInfo
=
info
=>
({
type
:
'
UPDATE_PROJECT_INFO
'
,
info
:
info
});
module
.
exports
.
setOriginalInfo
=
info
=>
({
type
:
'
SET_ORIGINAL
'
,
info
:
info
...
...
@@ -770,6 +779,25 @@ module.exports.restoreComment = (projectId, commentId, topLevelCommentId, token)
});
});
module
.
exports
.
shareProject
=
(
projectId
,
token
)
=>
(
dispatch
=>
{
dispatch
(
module
.
exports
.
setFetchStatus
(
'
project
'
,
module
.
exports
.
Status
.
FETCHING
));
api
({
uri
:
`/proxy/projects/
${
projectId
}
/share`
,
authentication
:
token
,
withCredentials
:
true
,
method
:
'
PUT
'
,
useCsrf
:
true
},
(
err
,
body
,
res
)
=>
{
if
(
err
||
res
.
statusCode
!==
200
)
{
dispatch
(
module
.
exports
.
setFetchStatus
(
'
project
'
,
module
.
exports
.
Status
.
ERROR
));
dispatch
(
module
.
exports
.
setError
(
err
));
return
;
}
dispatch
(
module
.
exports
.
setFetchStatus
(
'
project
'
,
module
.
exports
.
Status
.
FETCHED
));
dispatch
(
module
.
exports
.
updateProjectInfo
(
body
));
});
});
module
.
exports
.
reportProject
=
(
id
,
jsonData
,
token
)
=>
(
dispatch
=>
{
dispatch
(
module
.
exports
.
setFetchStatus
(
'
report
'
,
module
.
exports
.
Status
.
FETCHING
));
// scratchr2 will fail if no thumbnail base64 string provided. We don't yet have
...
...
src/views/preview/preview.jsx
View file @
476578cf
...
...
@@ -329,10 +329,8 @@ class Preview extends React.Component {
this
.
props
.
setPlayer
(
false
);
}
handleShare
()
{
this
.
props
.
updat
eProject
(
this
.
props
.
shar
eProject
(
this
.
props
.
projectInfo
.
id
,
{
isPublished
:
true
},
this
.
props
.
user
.
username
,
this
.
props
.
user
.
token
);
}
...
...
@@ -552,6 +550,7 @@ Preview.propTypes = {
setFullScreen
:
PropTypes
.
func
.
isRequired
,
setLovedStatus
:
PropTypes
.
func
.
isRequired
,
setPlayer
:
PropTypes
.
func
.
isRequired
,
shareProject
:
PropTypes
.
func
.
isRequired
,
toggleStudio
:
PropTypes
.
func
.
isRequired
,
updateProject
:
PropTypes
.
func
.
isRequired
,
user
:
PropTypes
.
shape
({
...
...
@@ -708,6 +707,9 @@ const mapDispatchToProps = dispatch => ({
setLovedStatus
:
(
loved
,
id
,
username
,
token
)
=>
{
dispatch
(
previewActions
.
setLovedStatus
(
loved
,
id
,
username
,
token
));
},
shareProject
:
(
id
,
token
)
=>
{
dispatch
(
previewActions
.
shareProject
(
id
,
token
));
},
reportProject
:
(
id
,
formData
,
token
)
=>
{
dispatch
(
previewActions
.
reportProject
(
id
,
formData
,
token
));
},
...
...
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