mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 13:10:13 -07:00
Fixed: Album API query by foreignId only returns requested album
Setting the new 'includeAllArtistAlbums' will give the existing behaviour of returning all albums for that artist
This commit is contained in:
parent
11c0f1dad2
commit
7b288bfcd3
2 changed files with 16 additions and 3 deletions
|
@ -55,7 +55,10 @@ class AlbumDetailsPageConnector extends Component {
|
||||||
populate = () => {
|
populate = () => {
|
||||||
const foreignAlbumId = this.props.foreignAlbumId;
|
const foreignAlbumId = this.props.foreignAlbumId;
|
||||||
this.setState({ hasMounted: true });
|
this.setState({ hasMounted: true });
|
||||||
this.props.fetchAlbums({ foreignAlbumId });
|
this.props.fetchAlbums({
|
||||||
|
foreignAlbumId,
|
||||||
|
includeAllArtistAlbums: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
unpopulate = () => {
|
unpopulate = () => {
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace Lidarr.Api.V1.Albums
|
||||||
var artistIdQuery = Request.Query.ArtistId;
|
var artistIdQuery = Request.Query.ArtistId;
|
||||||
var albumIdsQuery = Request.Query.AlbumIds;
|
var albumIdsQuery = Request.Query.AlbumIds;
|
||||||
var foreignIdQuery = Request.Query.ForeignAlbumId;
|
var foreignIdQuery = Request.Query.ForeignAlbumId;
|
||||||
|
var includeAllArtistAlbumsQuery = Request.Query.IncludeAllArtistAlbums;
|
||||||
|
|
||||||
if (!Request.Query.ArtistId.HasValue && !albumIdsQuery.HasValue && !foreignIdQuery.HasValue)
|
if (!Request.Query.ArtistId.HasValue && !albumIdsQuery.HasValue && !foreignIdQuery.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -57,9 +58,18 @@ namespace Lidarr.Api.V1.Albums
|
||||||
|
|
||||||
if (foreignIdQuery.HasValue)
|
if (foreignIdQuery.HasValue)
|
||||||
{
|
{
|
||||||
int artistId = _albumService.FindById(foreignIdQuery.Value).ArtistId;
|
string foreignAlbumId = foreignIdQuery.Value.ToString();
|
||||||
|
|
||||||
return MapToResource(_albumService.GetAlbumsByArtist(artistId), false);
|
var album = _albumService.FindById(foreignAlbumId);
|
||||||
|
|
||||||
|
if (includeAllArtistAlbumsQuery.HasValue && Convert.ToBoolean(includeAllArtistAlbumsQuery.Value))
|
||||||
|
{
|
||||||
|
return MapToResource(_albumService.GetAlbumsByArtist(album.ArtistId), false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return MapToResource(new List<Album> { album }, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string albumIdsValue = albumIdsQuery.Value.ToString();
|
string albumIdsValue = albumIdsQuery.Value.ToString();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue