Encoding playlist during AddTracksToPlaylist, patch missing connect; fixes #684
This commit is contained in:
@ -54,8 +54,10 @@ class PlaylistGrid extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => state;
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
uiActions: bindActionCreators(uiActions, dispatch),
|
||||
});
|
||||
|
||||
export default connect(mapDispatchToProps)(PlaylistGrid);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(PlaylistGrid);
|
||||
|
||||
@ -5,7 +5,8 @@ import { uriSource } from '../../util/helpers';
|
||||
const spotifyActions = require('../../services/spotify/actions');
|
||||
const mopidyActions = require('../../services/mopidy/actions');
|
||||
|
||||
export function handleException(message, data = {}, description = null, show_notification = true) {
|
||||
export function handleException(message = '', data = {}, description = null, show_notification = true) {
|
||||
console.debug({ message, data })
|
||||
if (!message) {
|
||||
if (data.message) {
|
||||
message = data.message;
|
||||
|
||||
@ -3,7 +3,7 @@ import ReactGA from 'react-ga';
|
||||
import Mopidy from 'mopidy';
|
||||
import { sha256 } from 'js-sha256';
|
||||
import { sampleSize, compact, chunk } from 'lodash';
|
||||
import { i18n } from '../../locale';
|
||||
import { i18n, I18n } from '../../locale';
|
||||
import {
|
||||
generateGuid,
|
||||
uriSource,
|
||||
@ -1217,6 +1217,12 @@ const MopidyMiddleware = (function () {
|
||||
case 'MOPIDY_ADD_PLAYLIST_TRACKS':
|
||||
request(store, 'playlists.lookup', { uri: action.key })
|
||||
.then((response) => {
|
||||
if (!response) {
|
||||
store.dispatch(coreActions.handleException(
|
||||
i18n('errors.uri_not_found', { uri: action.key }),
|
||||
));
|
||||
return;
|
||||
}
|
||||
const tracks = action.tracks_uris.map((uri) => ({ __model__: 'Track', uri }));
|
||||
const playlist = { ...response };
|
||||
if (playlist.tracks) {
|
||||
|
||||
@ -10,10 +10,10 @@ import * as coreActions from '../../services/core/actions';
|
||||
import * as uiActions from '../../services/ui/actions';
|
||||
import * as mopidyActions from '../../services/mopidy/actions';
|
||||
import * as spotifyActions from '../../services/spotify/actions';
|
||||
import { sourceIcon, decodeMopidyUri } from '../../util/helpers';
|
||||
import { sourceIcon } from '../../util/helpers';
|
||||
import { sortItems } from '../../util/arrays';
|
||||
import { I18n, i18n } from '../../locale';
|
||||
import { collate } from '../../util/format';
|
||||
import { collate, decodeUri } from '../../util/format';
|
||||
import { makeProcessProgressSelector } from '../../util/selectors';
|
||||
|
||||
const processKeys = [
|
||||
@ -57,7 +57,7 @@ class AddToPlaylist extends React.Component {
|
||||
},
|
||||
uris,
|
||||
} = this.props;
|
||||
const encodedUris = uris.map((uri) => decodeMopidyUri(uri));
|
||||
const encodedUris = uris.map((uri) => decodeUri(uri));
|
||||
addTracksToPlaylist(playlist_uri, encodedUris);
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user