Cleaning up 404

This commit is contained in:
James Barnsley
2019-01-30 16:59:51 +13:00
parent 31213c34ba
commit 5b96bdeabc
8 changed files with 32 additions and 30 deletions

View File

@ -73217,7 +73217,7 @@ var Album = function (_React$Component) {
'p',
null,
'Could not find album with URI "',
this.props.uri,
encodeURIComponent(this.props.uri),
'"'
)
);
@ -73844,7 +73844,7 @@ var Artist = function (_React$Component) {
'p',
null,
'Could not find artist with URI "',
this.props.uri,
encodeURIComponent(this.props.uri),
'"'
)
);
@ -74915,7 +74915,7 @@ var Playlist = function (_React$Component) {
'p',
null,
'Could not find playlist with URI "',
this.props.uri,
encodeURIComponent(this.props.uri),
'"'
)
);
@ -75147,15 +75147,15 @@ var User = function (_React$Component) {
key: 'componentDidMount',
value: function componentDidMount() {
this.setWindowTitle();
this.props.coreActions.loadUser(this.props.match.params.uri);
this.props.coreActions.loadUserPlaylists(this.props.match.params.uri);
this.props.coreActions.loadUser(this.props.uri);
this.props.coreActions.loadUserPlaylists(this.props.uri);
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (nextProps.match.params.uri != this.props.match.params.uri) {
this.props.coreActions.loadUser(nextProps.match.params.uri);
this.props.coreActions.loadUserPlaylists(this.props.match.params.uri);
if (nextProps.uri != this.props.uri) {
this.props.coreActions.loadUser(nextProps.uri);
this.props.coreActions.loadUserPlaylists(this.props.uri);
}
if (!this.props.user && nextProps.user) {
@ -75178,14 +75178,14 @@ var User = function (_React$Component) {
value: function loadMore() {
this.props.spotifyActions.getMore(this.props.user.playlists_more, {
parent_type: 'user',
parent_key: this.props.match.params.uri,
parent_key: this.props.uri,
records_type: 'playlist'
});
}
}, {
key: 'isMe',
value: function isMe() {
var userid = helpers.getFromUri('userid', this.props.match.params.uri);
var userid = helpers.getFromUri('userid', this.props.uri);
return this.props.me && this.props.me.id && this.props.me.id == userid;
}
}, {
@ -75193,7 +75193,7 @@ var User = function (_React$Component) {
value: function render() {
var _this2 = this;
var user_id = helpers.getFromUri('userid', this.props.match.params.uri);
var user_id = helpers.getFromUri('userid', this.props.uri);
if (!this.props.user) {
if (helpers.isLoading(this.props.load_queue, ['spotify_users/' + user_id, 'spotify_users/' + user_id + '/playlists/?'])) {
@ -75210,7 +75210,7 @@ var User = function (_React$Component) {
'p',
null,
'Could not find user with URI "',
this.props.uri,
encodeURIComponent(this.props.uri),
'"'
)
);
@ -75305,8 +75305,9 @@ var User = function (_React$Component) {
}(_react2.default.Component);
var mapStateToProps = function mapStateToProps(state, ownProps) {
var uri = ownProps.match.params.uri;
var uri = decodeURIComponent(ownProps.match.params.uri);
return {
uri: uri,
me: state.spotify.me,
load_queue: state.ui.load_queue,
spotify_authorized: state.spotify.authorization,
@ -75640,7 +75641,7 @@ var Track = function (_React$Component) {
'p',
null,
'Could not find track with URI "',
this.props.uri,
encodeURIComponent(this.props.uri),
'"'
)
);

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1548807686";
var build = "1548807768";
var version = "3.32.0";
// Construct the script tag

View File

@ -118,7 +118,7 @@ class Album extends React.Component{
} else {
return (
<ErrorMessage type="not-found" title="Not found">
<p>Could not find album with URI "{this.props.uri}"</p>
<p>Could not find album with URI "{encodeURIComponent(this.props.uri)}"</p>
</ErrorMessage>
);
}

View File

@ -294,7 +294,7 @@ class Artist extends React.Component{
} else {
return (
<ErrorMessage type="not-found" title="Not found">
<p>Could not find artist with URI "{this.props.uri}"</p>
<p>Could not find artist with URI "{encodeURIComponent(this.props.uri)}"</p>
</ErrorMessage>
);
}

View File

@ -184,7 +184,7 @@ class Playlist extends React.Component{
} else {
return (
<ErrorMessage type="not-found" title="Not found">
<p>Could not find playlist with URI "{this.props.uri}"</p>
<p>Could not find playlist with URI "{encodeURIComponent(this.props.uri)}"</p>
</ErrorMessage>
);
}

View File

@ -184,7 +184,7 @@ class Track extends React.Component{
} else {
return (
<ErrorMessage type="not-found" title="Not found">
<p>Could not find track with URI "{this.props.uri}"</p>
<p>Could not find track with URI "{encodeURIComponent(this.props.uri)}"</p>
</ErrorMessage>
);
}

View File

@ -26,14 +26,14 @@ class User extends React.Component{
componentDidMount(){
this.setWindowTitle();
this.props.coreActions.loadUser(this.props.match.params.uri);
this.props.coreActions.loadUserPlaylists(this.props.match.params.uri);
this.props.coreActions.loadUser(this.props.uri);
this.props.coreActions.loadUserPlaylists(this.props.uri);
}
componentWillReceiveProps(nextProps){
if (nextProps.match.params.uri != this.props.match.params.uri){
this.props.coreActions.loadUser(nextProps.match.params.uri);
this.props.coreActions.loadUserPlaylists(this.props.match.params.uri);
if (nextProps.uri != this.props.uri){
this.props.coreActions.loadUser(nextProps.uri);
this.props.coreActions.loadUserPlaylists(this.props.uri);
}
if (!this.props.user && nextProps.user){
@ -54,19 +54,19 @@ class User extends React.Component{
this.props.user.playlists_more,
{
parent_type: 'user',
parent_key: this.props.match.params.uri,
parent_key: this.props.uri,
records_type: 'playlist'
}
);
}
isMe(){
let userid = helpers.getFromUri('userid',this.props.match.params.uri);
let userid = helpers.getFromUri('userid',this.props.uri);
return (this.props.me && this.props.me.id && this.props.me.id == userid);
}
render(){
var user_id = helpers.getFromUri('userid',this.props.match.params.uri);
var user_id = helpers.getFromUri('userid',this.props.uri);
if (!this.props.user){
if (helpers.isLoading(this.props.load_queue,['spotify_users/'+user_id,'spotify_users/'+user_id+'/playlists/?'])){
@ -78,7 +78,7 @@ class User extends React.Component{
} else {
return (
<ErrorMessage type="not-found" title="Not found">
<p>Could not find user with URI "{this.props.uri}"</p>
<p>Could not find user with URI "{encodeURIComponent(this.props.uri)}"</p>
</ErrorMessage>
);
}
@ -130,8 +130,9 @@ class User extends React.Component{
}
const mapStateToProps = (state, ownProps) => {
var uri = ownProps.match.params.uri;
var uri = decodeURIComponent(ownProps.match.params.uri);
return {
uri: uri,
me: state.spotify.me,
load_queue: state.ui.load_queue,
spotify_authorized: state.spotify.authorization,