mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
Update avatar thumbnailUrl per discussion
This commit is contained in:
parent
ef95746df7
commit
06f71a0da6
5 changed files with 17 additions and 26 deletions
|
@ -33,7 +33,11 @@ if ( process.env.NODE_ENV != 'production' ) {
|
||||||
var proxyRoute = proxies[proxyId];
|
var proxyRoute = proxies[proxyId];
|
||||||
app.use(proxyRoute.root, proxy(proxyRoute.proxy || proxyHost, {
|
app.use(proxyRoute.root, proxy(proxyRoute.proxy || proxyHost, {
|
||||||
filter: function (req) {
|
filter: function (req) {
|
||||||
return proxyRoute.paths.indexOf(url.parse(req.url).path) > -1;
|
for (var pathId in proxyRoute.paths) {
|
||||||
|
var path = proxyRoute.paths[pathId];
|
||||||
|
if (url.parse(req.url).path.indexOf(path) == 0) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
forwardPath: function (req) {
|
forwardPath: function (req) {
|
||||||
return url.parse(req.url).path;
|
return url.parse(req.url).path;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"paths": [
|
"paths": [
|
||||||
"/session/",
|
"/session/",
|
||||||
"/accounts/login/",
|
"/accounts/login/",
|
||||||
"/accounts/logout/"
|
"/accounts/logout/",
|
||||||
|
"/get_image/"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,31 +1,20 @@
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
var classNames = require('classnames');
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
path: React.PropTypes.string,
|
src: React.PropTypes.string
|
||||||
userId: React.PropTypes.number,
|
|
||||||
size: React.PropTypes.number,
|
|
||||||
extension: React.PropTypes.string,
|
|
||||||
version: React.PropTypes.number
|
|
||||||
},
|
},
|
||||||
getDefaultProps: function () {
|
getDefaultProps: function () {
|
||||||
return {
|
return {
|
||||||
path: '//cdn2.scratch.mit.edu/get_image/user/',
|
src: '//cdn2.scratch.mit.edu/get_image/user/2584924_24x24.png?v=1438702210.96'
|
||||||
userId: 2584924,
|
|
||||||
size: 32,
|
|
||||||
extension: 'png',
|
|
||||||
version: 1438702210.96
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getImageUrl: function () {
|
|
||||||
return (
|
|
||||||
this.props.path + this.props.userId + '_' +
|
|
||||||
this.props.size + 'x' + this.props.size + '.' +
|
|
||||||
this.props.extension + '?v=' + this.props.version);
|
|
||||||
},
|
|
||||||
render: function () {
|
render: function () {
|
||||||
var url = this.getImageUrl();
|
var classes = classNames(
|
||||||
return (
|
'avatar',
|
||||||
<img className="avatar" src={url} />);
|
this.props.className
|
||||||
|
);
|
||||||
|
return <img {... this.props} className={classes} />;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -95,10 +95,7 @@ module.exports = React.createClass({
|
||||||
</li>,
|
</li>,
|
||||||
<li className="link right account-nav" key="account-nav">
|
<li className="link right account-nav" key="account-nav">
|
||||||
<a className="userInfo" href="#" onClick={this.handleClickAccountNav}>
|
<a className="userInfo" href="#" onClick={this.handleClickAccountNav}>
|
||||||
<Avatar
|
<Avatar src={this.state.session.user.thumbnailUrl} />
|
||||||
userId={this.state.session.user.id}
|
|
||||||
version={this.state.session.user.avatarVersion}
|
|
||||||
size={24} />
|
|
||||||
{this.state.session.user.username}
|
{this.state.session.user.username}
|
||||||
</a>
|
</a>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"user": {
|
"user": {
|
||||||
"id": 1709047,
|
"id": 1709047,
|
||||||
"username": "thisandagain",
|
"username": "thisandagain",
|
||||||
"avatarVersion": 1438702210.96
|
"thumbnailUrl": "//cdn2.scratch.mit.edu/get_image/user/1709047_32x32.png?v=1427980331.0"
|
||||||
},
|
},
|
||||||
"permissions": {
|
"permissions": {
|
||||||
"admin": true,
|
"admin": true,
|
||||||
|
|
Loading…
Reference in a new issue