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
fa5551ac
Commit
fa5551ac
authored
Jun 29, 2016
by
Matthew Taylor
Committed by
GitHub
Jun 29, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #615 from mewtaylor/bugfix/teacher-banner-login
[Bugfix] Add permissions dispatch for `WillReceiveProps`
parents
16fe86b2
7bb52c25
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
src/components/navigation/www/navigation.jsx
src/components/navigation/www/navigation.jsx
+4
-3
src/lib/render.jsx
src/lib/render.jsx
+3
-1
src/redux/session.js
src/redux/session.js
+4
-0
src/views/splash/splash.jsx
src/views/splash/splash.jsx
+0
-5
No files found.
src/components/navigation/www/navigation.jsx
View file @
fa5551ac
...
...
@@ -259,14 +259,14 @@ var Navigation = React.createClass({
<
FormattedMessage
id=
"general.myStuff"
/>
</
a
>
</
li
>
{
this
.
props
.
session
.
session
.
permissions
.
educator
?
[
{
this
.
props
.
permissions
.
educator
?
[
<
li
>
<
a
href=
"/educators/classes/"
>
<
FormattedMessage
id=
"general.myClasses"
/>
</
a
>
</
li
>
]
:
[]
}
{
this
.
props
.
session
.
session
.
permissions
.
student
?
[
{
this
.
props
.
permissions
.
student
?
[
<
li
>
<
a
href=
{
'
/classes/
'
+
this
.
props
.
session
.
session
.
user
.
classroomId
+
'
/
'
}
>
<
FormattedMessage
id=
"general.myClass"
/>
...
...
@@ -335,7 +335,8 @@ var Navigation = React.createClass({
var
mapStateToProps
=
function
(
state
)
{
return
{
session
:
state
.
session
session
:
state
.
session
,
permissions
:
state
.
permissions
};
};
...
...
src/lib/render.jsx
View file @
fa5551ac
...
...
@@ -6,6 +6,7 @@ var ReactDOM = require('react-dom');
var
StoreProvider
=
require
(
'
react-redux
'
).
Provider
;
var
IntlProvider
=
require
(
'
./intl.jsx
'
).
IntlProvider
;
var
permissionsActions
=
require
(
'
../redux/permissions.js
'
);
var
sessionActions
=
require
(
'
../redux/session.js
'
);
var
reducer
=
require
(
'
../redux/reducer.js
'
);
...
...
@@ -42,7 +43,8 @@ var render = function (jsx, element) {
element
);
// Get initial session
// Get initial session & permissions
store
.
dispatch
(
permissionsActions
.
getPermissions
());
store
.
dispatch
(
sessionActions
.
refreshSession
());
};
...
...
src/redux/session.js
View file @
fa5551ac
...
...
@@ -2,6 +2,7 @@ var keyMirror = require('keymirror');
var
defaults
=
require
(
'
lodash.defaults
'
);
var
api
=
require
(
'
../lib/api
'
);
var
permissionsActions
=
require
(
'
./permissions.js
'
);
var
tokenActions
=
require
(
'
./token.js
'
);
var
Types
=
keyMirror
({
...
...
@@ -75,6 +76,9 @@ module.exports.refreshSession = function () {
dispatch
(
tokenActions
.
getToken
());
dispatch
(
module
.
exports
.
setSession
(
body
));
dispatch
(
module
.
exports
.
setStatus
(
module
.
exports
.
Status
.
FETCHED
));
// get the permissions from the updated session
dispatch
(
permissionsActions
.
getPermissions
());
return
;
}
}
...
...
src/views/splash/splash.jsx
View file @
fa5551ac
...
...
@@ -4,7 +4,6 @@ var omit = require('lodash.omit');
var
React
=
require
(
'
react
'
);
var
api
=
require
(
'
../../lib/api
'
);
var
permissionsActions
=
require
(
'
../../redux/permissions.js
'
);
var
render
=
require
(
'
../../lib/render.jsx
'
);
var
sessionActions
=
require
(
'
../../redux/session.js
'
);
var
shuffle
=
require
(
'
../../lib/shuffle.js
'
).
shuffle
;
...
...
@@ -62,10 +61,6 @@ var Splash = injectIntl(React.createClass({
}
}
},
componentWillMount
:
function
()
{
// Determine whether to show the teacher banner or not
this
.
props
.
dispatch
(
permissionsActions
.
getPermissions
());
},
componentDidMount
:
function
()
{
this
.
getFeaturedGlobal
();
if
(
this
.
props
.
session
.
session
.
user
)
{
...
...
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