Correctly pulling album name as title for directory (if directory.album.name)

This commit is contained in:
James Barnsley
2020-11-12 20:51:36 +13:00
parent 3f7cca7f3d
commit 148c1fb602

View File

@ -1611,10 +1611,25 @@ const MopidyMiddleware = (function () {
if (uri) {
request(store, 'library.lookup', { uris: [uri] })
.then((response) => {
if (!response[uri] || !response[uri].length) return;
const {
[uri]: results = [],
} = response;
if (!results.length) return;
let result = results[0];
if (result.album) {
result = {
...result,
name: result.album.name,
};
}
store.dispatch({
type: 'MOPIDY_DIRECTORY_LOADED',
directory: formatSimpleObject(response[uri][0]),
directory: {
...formatSimpleObject(result),
},
});
});
}